Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFlags ¶
AddFlags registers --json, --jq, --template, and --limit flags on the given command.
func AddFlagsNoLimit ¶
AddFlagsNoLimit registers --json, --jq, --template flags but NOT --limit.
func ApplyLimit ¶
ApplyLimit trims a slice to at most limit items. If limit <= 0 the slice is returned unchanged.
func IsTerminal ¶
func IsTerminal() bool
IsTerminal returns true when stdout is a terminal (not piped).
Types ¶
type Options ¶
type Options struct {
JSON string // comma-separated field names, or empty for all fields
Jq string // jq expression to filter JSON output
Template string // Go template string to format JSON output
Limit int // maximum number of items (0 = unlimited)
}
Options holds the output-related flags shared across list/view commands.
func (*Options) PrintJSON ¶
PrintJSON serializes items as a JSON array (or single object for non-slice types), optionally filtering to the requested fields, then applies --jq or --template if set.
func (*Options) RequestedFields ¶
RequestedFields parses --json into a set of field names. Returns nil when all fields should be included (--json with no value, or --json *).