Documentation ¶
Overview ¶
package formatdata provides pretty-print function FormatData and its variations
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatData ¶
FormatData is the simplest API.
data is any data to show. Nested array or array of struct will be formatted in table.
o is an optional. It controls format, style and so on.
func FormatDataTo ¶
FormatDataTo is variation of FormatData. You can specify output destination.
If out is terminal, it uses escape sequence to dump colorized output.
func FormatDataWithColor ¶
FormatDataWithColor is FormatDataTo's variation that always uses escape sequence to dump colorized output.
func FormatDataWithoutColor ¶
FormatDataWithColor is FormatDataTo's variation that always doesn't use escape sequence.
Types ¶
type Opt ¶
type Opt struct { OutputFormat OutputFormat EastAsianAmbiguousAsWide bool Formatter string // "terminal", "terminal8", "terminal16", "terminal256", "terminal16m". Default: "terminal" Style string // https://github.com/alecthomas/chroma/tree/master/styles. Default: "monokai" Indent int // Indent for JSON/YAML }
type OutputFormat ¶
type OutputFormat = int
const ( Terminal OutputFormat = iota // Default. If data is not grid compatible, fallback to YAML. Markdown // Markdown table. If data is not grid compatible, fallback to YAML. JSON YAML )
Click to show internal directories.
Click to hide internal directories.