{"modulePath":"github.com/hostimdev/cli","version":"v0.1.62","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package output\n\nPackage output renders command results either as aligned text tables (default) or as JSON (-o json) for scripting.\n\n## Types\n\n```go\ntype Format string\n```\nFormat is the selected output format.\n\n```go\nconst (\n\tFormatTable Format = \"table\"\n\tFormatJSON  Format = \"json\"\n)\n```\n\n```go\nfunc Parse(s string) (Format, error)\n```\nParse validates a --output value.\n\n```go\ntype Printer struct {\n\tFormat Format\n\tOut    io.Writer\n}\n```\nPrinter writes results in the chosen format.\n\n```go\nfunc (p Printer) JSON(v any) error\n```\nJSON writes v as indented JSON. Used directly by read commands under -o json.\n\n```go\nfunc (p Printer) Render(v any, headers []string, rows [][]string) error\n```\nRender prints v as JSON when Format is JSON, otherwise calls table with the supplied header/row builder. This keeps every read command a one-liner.\n\n```go\nfunc (p Printer) Table(headers []string, rows [][]string) error\n```\nTable writes a header + rows as an aligned table.\n\n","path":"github.com/hostimdev/cli/internal/output","name":"output","synopsis":"Package output renders command results either as aligned text tables (default) or as JSON (-o json) for scripting.","isRedistributable":true}
