Documentation
¶
Index ¶
- func Format(format string, data interface{}) error
- type CSVFormatter
- type Formatter
- type FormatterWrapper
- func (f *FormatterWrapper) GetFormat() string
- func (f *FormatterWrapper) Print(data interface{}) error
- func (f *FormatterWrapper) PrintError(err error)
- func (f *FormatterWrapper) PrintInfo(msg string)
- func (f *FormatterWrapper) PrintSuccess(msg string)
- func (f *FormatterWrapper) PrintTo(w io.Writer, data interface{}) error
- func (f *FormatterWrapper) PrintWarning(msg string)
- func (f *FormatterWrapper) SetColor(useColor bool)
- func (f *FormatterWrapper) SetFormat(format string) error
- func (f *FormatterWrapper) SetQuiet(quiet bool)
- func (f *FormatterWrapper) SetTableHeader(headers []string)
- type JSONFormatter
- type TableFormatter
- type YAMLFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CSVFormatter ¶
CSVFormatter formats output as CSV
func (*CSVFormatter) Format ¶
func (f *CSVFormatter) Format(data interface{}) error
type Formatter ¶
type Formatter interface {
Format(data interface{}) error
}
Formatter is an interface for output formatters
type FormatterWrapper ¶
type FormatterWrapper struct {
// contains filtered or unexported fields
}
FormatterWrapper wraps the output functionality to implement the OutputFormatter interface
func NewFormatter ¶
func NewFormatter(config interface{ GetString(string) string }) *FormatterWrapper
NewFormatter creates a new output formatter with config
func (*FormatterWrapper) GetFormat ¶
func (f *FormatterWrapper) GetFormat() string
GetFormat returns the current output format
func (*FormatterWrapper) Print ¶
func (f *FormatterWrapper) Print(data interface{}) error
Print formats and prints data according to the configured format
func (*FormatterWrapper) PrintError ¶
func (f *FormatterWrapper) PrintError(err error)
PrintError prints an error message
func (*FormatterWrapper) PrintInfo ¶
func (f *FormatterWrapper) PrintInfo(msg string)
PrintInfo prints an informational message
func (*FormatterWrapper) PrintSuccess ¶
func (f *FormatterWrapper) PrintSuccess(msg string)
PrintSuccess prints a success message
func (*FormatterWrapper) PrintTo ¶
func (f *FormatterWrapper) PrintTo(w io.Writer, data interface{}) error
PrintTo formats and prints data to the specified writer
func (*FormatterWrapper) PrintWarning ¶
func (f *FormatterWrapper) PrintWarning(msg string)
PrintWarning prints a warning message
func (*FormatterWrapper) SetColor ¶
func (f *FormatterWrapper) SetColor(useColor bool)
SetColor sets color output mode
func (*FormatterWrapper) SetFormat ¶
func (f *FormatterWrapper) SetFormat(format string) error
SetFormat sets the output format
func (*FormatterWrapper) SetQuiet ¶
func (f *FormatterWrapper) SetQuiet(quiet bool)
SetQuiet sets quiet mode
func (*FormatterWrapper) SetTableHeader ¶
func (f *FormatterWrapper) SetTableHeader(headers []string)
SetTableHeader sets the table header (for table format)
type JSONFormatter ¶
JSONFormatter formats output as JSON
func (*JSONFormatter) Format ¶
func (f *JSONFormatter) Format(data interface{}) error
type TableFormatter ¶
type TableFormatter struct {
Writer io.Writer
NoHeader bool
Columns []string
ShowEmpty bool
ColorEnabled bool
}
TableFormatter formats output as a table
func (*TableFormatter) Format ¶
func (f *TableFormatter) Format(data interface{}) error
type YAMLFormatter ¶
YAMLFormatter formats output as YAML
func (*YAMLFormatter) Format ¶
func (f *YAMLFormatter) Format(data interface{}) error