output

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(format string, data interface{}) error

Format formats and prints data according to the specified format

Types

type CSVFormatter

type CSVFormatter struct {
	Writer io.Writer
}

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

type JSONFormatter struct {
	Writer io.Writer
}

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

type YAMLFormatter struct {
	Writer io.Writer
}

YAMLFormatter formats output as YAML

func (*YAMLFormatter) Format

func (f *YAMLFormatter) Format(data interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL