Documentation
¶
Overview ¶
Package output prints command results: tables, JSON, YAML, ASCII graphs, human sizes, and shell-split command lines.
Tables use ASCII borders only, so output is byte-identical on Linux, macOS, and legacy Windows consoles. JSON and YAML marshal with stable key order for golden tests and pipes.
Index ¶
- Constants
- func Bytes(n uint64) string
- func Graph(values []float64) string
- func IBytes(n uint64) string
- func JSON(w io.Writer, v any) error
- func Render(w io.Writer, format string, v any) error
- func Split(s string) ([]string, error)
- func Table(w io.Writer, header []string, rows [][]string) error
- func YAML(w io.Writer, v any) error
- type TableValue
Constants ¶
const ( FormatTable = "table" FormatJSON = "json" FormatYAML = "yaml" )
Formats for Render and the --output flag.
Variables ¶
This section is empty.
Functions ¶
func Graph ¶
Graph renders values as a plain-ASCII line chart (no color codes, safe on every console).
func JSON ¶
JSON writes indented JSON plus a trailing newline. Map keys marshal in sorted order, so output is stable across runs.
func Render ¶
Render writes v in the named format: table, json, or yaml. Tables need a header plus string rows: pass TableValue{Header, Rows}. Anything else returns an error (app validates --output earlier too).
Types ¶
type TableValue ¶
TableValue carries a table for Render.