output

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatValue

func FormatValue(v any) string

FormatValue converts a value to its string representation for table/csv/plain output.

Types

type Format

type Format string

Format represents an output format

const (
	FormatTable Format = "table"
	FormatJSON  Format = "json"
	FormatCSV   Format = "csv"
	FormatYAML  Format = "yaml"
	FormatPlain Format = "plain"
)

type Formatter

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter handles output formatting

func New

func New(format string, noColor bool, wide bool) *Formatter

New creates a new formatter

func (*Formatter) Print

func (f *Formatter) Print(data any) error

Print outputs data in the configured format

func (*Formatter) PrintError

func (f *Formatter) PrintError(err error, code string, details map[string]any)

PrintError outputs an error in the appropriate format

func (*Formatter) PrintRaw

func (f *Formatter) PrintRaw(data []byte) error

PrintRaw outputs raw bytes (usually JSON from the API). XML responses (from Classic API) are converted to JSON before formatting.

func (*Formatter) SetWriter

func (f *Formatter) SetWriter(w io.Writer)

SetWriter replaces the output destination.

Jump to

Keyboard shortcuts

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