-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #25878 - New lines in text attr dont break output
- Loading branch information
Showing
12 changed files
with
163 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Output | ||
------------------------------ | ||
|
||
### Adapters | ||
Output adapter is responsible for rendering the output in a specific way using | ||
__formatters__ (see below). | ||
Hammer comes with following adapters: | ||
* __base__ - simple output, structured records | ||
* __table__ - records printed in tables, ideal for printing lists of records | ||
* __csv__ - comma separated output, ideal for scripting and grepping | ||
* __yaml__ - YAML output | ||
* __json__ - JSON output | ||
* __silent__ - no output, used for testing | ||
|
||
### Formatters | ||
Formatter is a bit of code that can modify a representation of a field during | ||
output rendering. Formatter is registered for specific field type. Each field | ||
type can have multiple formatters. | ||
* __ColorFormatter__ - colors data with a specific color | ||
* __DateFormatter__ - formats a date string with `%Y/%m/%d %H:%M:%S` style | ||
* __ListFormatter__ - formats an array of data with csv style | ||
* __KeyValueFormatter__ - formats a hash with `key => value` style | ||
* __BooleanFormatter__ - converts `1/0`/`true/false`/`""` to `"yes"`/`"no"` | ||
* __LongTextFormatter__ - adds a new line at the start of the data string | ||
* __InlineTextFormatter__ - removes all new lines from data string | ||
* __MultilineTextFormatter__ - splits a long data string to fixed size chunks | ||
with indentation | ||
|
||
### Formatter features/Adapter limitations | ||
Currently used formatter features (or adapter limitations) are of two kinds. | ||
The first one help us to align by structure of the output: | ||
* __:flat__ - means the fields are serialized into a string (__table__, __csv__, __base__ adapters) | ||
* __:data__ - means the output is structured (__yaml__, __json__ adapters) | ||
* __:inline__ - means that the value will be rendered into single line without newlines (__table__, __csv__ adapters) | ||
* __:multiline__ - means that the properly indented value will be printed over multiple lines (__base__ adapter) | ||
|
||
The other kind serves to distinguish the cases where we can use the xterm colors | ||
to improve the output: | ||
* __:screen__ - means we can use the xterm colors (__table__, __base__ adapters) | ||
* __:file__ - unused yet | ||
|
||
All the features the formatter has need to match (be present in) the adapter's | ||
limitations. Otherwise the formatter won't apply. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,9 @@ class List < Field | |
class LongText < Field | ||
end | ||
|
||
class Text < Field | ||
end | ||
|
||
class KeyValue < Field | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.