Documentation
¶
Overview ¶
Package output provides formatters for command output.
Package output provides common output formatting utilities for CLI commands.
Index ¶
- func FormatAny(data any, globalFlags *globals.Flags) error
- func FormatAuthors(authors []catalogs.Author, globalFlags *globals.Flags) error
- func FormatModels(models []catalogs.Model, showDetails bool, globalFlags *globals.Flags) error
- func FormatProviders(providers []catalogs.Provider, showKeys bool, globalFlags *globals.Flags) 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 FormatAny ¶ added in v0.0.2
FormatAny handles the common pattern of formatting any data type for output. This is useful for commands with custom data structures.
func FormatAuthors ¶ added in v0.0.2
FormatAuthors handles the common pattern of formatting authors for output.
func FormatModels ¶ added in v0.0.2
FormatModels handles the common pattern of formatting models for output. This encapsulates the switch logic for different output formats.
Types ¶
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.