Documentation
¶
Overview ¶
Package output provides structured output formatting for the stackctl CLI. Commands use this package to print results in table, JSON, or YAML format depending on the --output / -o flag set by the user.
Index ¶
- func IsStructured() bool
- func PrintList(title string, headers []string, items []ListItem)
- func PrintRecord(title string, item ListItem)
- func PrintSecretMap(path string, data map[string]any)
- func PrintStatus(r StatusResult)
- func PrintValue(key, value string)
- func Set(format Format)
- func SetWriter(format Format, w io.Writer)
- type Format
- type ListItem
- type Pair
- type Printer
- type StatusResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsStructured ¶
func IsStructured() bool
IsStructured returns true when the current format is not table (i.e. machine-readable). Commands can use this to suppress emoji/decorative output.
func PrintRecord ¶
PrintRecord prints a single record (key/value pairs) using the global format.
func PrintSecretMap ¶
PrintSecretMap prints a map of secret key/values (e.g. vault secret get).
func PrintStatus ¶
func PrintStatus(r StatusResult)
PrintStatus prints a success/failure status with optional detail fields.
func PrintValue ¶
func PrintValue(key, value string)
PrintValue prints a single named value (e.g. generated password).
Types ¶
type Format ¶
type Format string
Format represents the output format selected by the user.
func ParseFormat ¶
ParseFormat converts a string to a Format, returning an error for unknown values.
type ListItem ¶
type ListItem struct {
Pairs []Pair
}
ListItem represents a single row in a tabular list. Keys are preserved in insertion order via the ordered Pairs slice.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer writes structured data to an output stream in the configured format.
func (*Printer) PrintRecord ¶
func (*Printer) PrintStatus ¶
func (p *Printer) PrintStatus(r StatusResult)
func (*Printer) PrintValue ¶
type StatusResult ¶
StatusResult holds the result of an operation (e.g. test-user).