Documentation
¶
Overview ¶
Package printing is the tt core's side of github.com/tarantool/tt/sdk/output: it makes the Printer a command writes its result through, with the formats the SDK does not encode itself - YAML - and the terminal check that decides styling.
YAML goes through output.Normalize before it is encoded, as JSON does, so one result decodes to the same data whichever of the two a script asks for. YAML on its own could do more - spell NaN and the infinities as .nan and .inf, keep the integer key 1 apart from the string key "1" - and a result that relies on that would read differently in JSON; normalising both is what keeps -o json and -o yaml interchangeable. It also covers a struct with no exported fields that only has a String form, which YAML, like JSON, would write as {}.
The YAML library honours encoding.TextMarshaler, so a value that marshals itself as text is written as that text, as in JSON. A []byte is the one value the two formats still write differently: JSON carries it as base64, YAML as a sequence of integers.
Index ¶
Constants ¶
const FormatYAML = output.FormatYAML
FormatYAML is output.FormatYAML, the format this package encodes.
Variables ¶
This section is empty.
Functions ¶
func Formats ¶
Formats are the formats every result-printing tt command accepts, in the order the help text lists them.
func NewPrinter ¶
NewPrinter returns a Printer writing to the process's streams in format.
Types ¶
This section is empty.