Documentation
¶
Overview ¶
Package output renders command results to stdout, choosing human text or JSON based on the --json flag. It is the analog of an HTTP response layer: the one place that decides how a result is shaped for the caller.
Golden rule: stdout is for machine/result output, stderr is for diagnostics (the logger). Never mix the two.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
Kind string `json:"kind"`
Time string `json:"ts,omitempty"`
Data any `json:"data,omitempty"`
}
Event is one streaming output record. In JSON mode it is emitted as a single NDJSON line; in human mode it renders as a short progress line.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer renders results either as human text or JSON.
func (*Writer) Error ¶
Error renders a failure. JSON: {"ok":false,"error":{code,message}}. Human: "error: <message>". The code is derived from the wrapped domain sentinel.
func (*Writer) Event ¶
Event emits one streaming record. JSON: a compact NDJSON line. Human: a short bullet line.
func (*Writer) JSON ¶
JSON reports whether the writer is in JSON mode (so callers can suppress chatty human-only output).