Documentation
¶
Overview ¶
Package output provides formatting utilities for CLI output.
Package output provides formatting utilities for CLI output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DefaultFielder ¶
type DefaultFielder interface {
// DefaultFields returns the list of field names to show by default
DefaultFields() []string
}
DefaultFielder is an optional interface that models can implement to specify which fields should be shown by default (similar to PHP's @default-fields).
type Format ¶
type Format string
Format represents output format types
const ( // FormatTable is table format FormatTable Format = "table" // FormatJSON is JSON format FormatJSON Format = "json" // FormatYAML is YAML format FormatYAML Format = "yaml" // FormatCSV is CSV format FormatCSV Format = "csv" // FormatList is simple list format (one item per line) FormatList Format = "list" )
type SerializedField ¶
type SerializedField struct {
// Name is the field name as it should appear in CSV headers and table columns
Name string
// Value is the field value
Value interface{}
}
SerializedField represents a single field in serialized output.
type Serializer ¶
type Serializer interface {
// Serialize returns an ordered list of fields for output.
// The order of fields in the returned slice determines the column order
// in CSV and table outputs.
Serialize() []SerializedField
}
Serializer is an interface that models can implement to control their CSV and table output formatting. This provides PHP Terminus-like behavior where models explicitly define field order and names.
Click to show internal directories.
Click to hide internal directories.