Documentation
¶
Overview ¶
Package format provides formatters for command output.
Package format provides common output formatting utilities for CLI commands.
Index ¶
- func Any(data any, globalFlags *globals.Flags) error
- func Authors(authors []*catalogs.Author, globalFlags *globals.Flags) error
- func Models(models []*catalogs.Model, showDetails bool, globalFlags *globals.Flags) error
- func Providers(providers []*catalogs.Provider, checker *auth.Checker, ...) error
- type Data
- type Format
- type Formatter
- type FormatterFunc
- type JSONFormatter
- type TableFormatter
- type YAMLFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Any ¶
Any handles the common pattern of formatting any data type for output. This is useful for commands with custom data structures.
Types ¶
type Data ¶
type Data struct {
Headers []string
Rows [][]string
ColumnAlignment []table.Align // Optional: column alignment (use table.AlignDefault, table.AlignLeft, table.AlignCenter, table.AlignRight)
}
Data represents data formatted for table output.
type Format ¶
type Format string
Format types for output.
const ( // FormatTable represents table output format. FormatTable Format = "table" // FormatJSON represents JSON output format. FormatJSON Format = "json" // FormatYAML represents YAML output format. FormatYAML Format = "yaml" // FormatWide represents wide table output format. FormatWide Format = "wide" )
func DetectFormat ¶
DetectFormat auto-detects format based on terminal and environment.
func ParseFormat ¶
ParseFormat converts string to Format with validation.
type Formatter ¶
Formatter interface for all output types.
func NewFormatter ¶
NewFormatter creates appropriate formatter based on format.
type FormatterFunc ¶
FormatterFunc allows functions to implement Formatter.
Click to show internal directories.
Click to hide internal directories.