Documentation
¶
Index ¶
- func IsValidFormat(format string) bool
- func ValidFormats() []string
- type Format
- type Formatter
- func (f *Formatter) Format() Format
- func (f *Formatter) NewTablePrinter() *TablePrinter
- func (f *Formatter) Print(data interface{}) error
- func (f *Formatter) PrintJSON(data interface{}) error
- func (f *Formatter) PrintTable(data TableData) error
- func (f *Formatter) PrintYAML(data interface{}) error
- func (f *Formatter) SetWriter(w io.Writer)
- type TableData
- type TablePrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidFormat ¶
IsValidFormat checks if the given format string is valid
Types ¶
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter handles output formatting for CLI commands
func NewFormatter ¶
NewFormatter creates a new formatter with the specified format
func (*Formatter) NewTablePrinter ¶
func (f *Formatter) NewTablePrinter() *TablePrinter
NewTablePrinter creates a new table printer
func (*Formatter) Print ¶
Print outputs data in the configured format For table format, data should implement TableData interface For JSON/YAML, data is serialized directly
func (*Formatter) PrintTable ¶
PrintTable outputs TableData as a formatted table
type TableData ¶
type TableData interface {
// Headers returns the column headers for the table
Headers() []string
// Rows returns the data rows for the table
Rows() [][]string
}
TableData interface for types that can be rendered as tables
type TablePrinter ¶
type TablePrinter struct {
// contains filtered or unexported fields
}
TablePrinter provides a fluent interface for building tables
func (*TablePrinter) Header ¶
func (t *TablePrinter) Header(columns ...string) *TablePrinter
func (*TablePrinter) Row ¶
func (t *TablePrinter) Row(values ...interface{}) *TablePrinter
Click to show internal directories.
Click to hide internal directories.