Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveMode ¶
ResolveMode maps the mode string to a concrete output format. When mode is "auto", it returns "text" for terminals and "json" for pipes.
Types ¶
type Formatter ¶
Formatter handles text and JSON output with auto-detection of terminal vs pipe.
func NewFormatter ¶
NewFormatter creates a Formatter that resolves "auto" mode by checking whether the writer is a terminal.
func (*Formatter) Error ¶
Error writes an error message. Text: "error: msg\n". JSON: {"error": "msg"}.
func (*Formatter) Result ¶
Result writes a map of key-value pairs. Text: sorted k/v lines. JSON: object.
func (*Formatter) Table ¶
Table writes tabular data. Text: aligned columns via tabwriter. JSON: array of objects keyed by headers.
Click to show internal directories.
Click to hide internal directories.