Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStdoutTTY ¶
func IsStdoutTTY() bool
IsStdoutTTY reports whether stdout is an interactive terminal. Respects NO_COLOR by returning false when set.
func RenderToFile ¶
RenderToFile writes v to the file at path. When opts.Format is empty or "auto", the format is inferred from the file extension (.json → "json"; anything else → "json" as default). Parent directories are created with mode 0755; the file is written with 0644.
func WriteRaw ¶ added in v0.2.0
WriteRaw streams r to the given file path (truncating). Intended for binary or extremely large payloads (e.g. workout SML/FIT exports) that should bypass the json/pretty formatter. This is the ONE sanctioned bypass of Render — every other command must go through Render/RenderToFile via emit().
func WriteRawStdout ¶ added in v0.2.0
WriteRawStdout streams r to os.Stdout. Same caveat as WriteRaw.
Types ¶
type Opts ¶
type Opts struct {
Format string // "json", "pretty", "auto", or ""
IsTTY bool
// Fields, when non-empty, projects the encoded output down to just these
// JSON keys before rendering. Forces JSON output (pretty rendering of an
// arbitrary projection isn't well-defined). See projectJSON for shape rules.
Fields []string
}
Opts controls how output is rendered.