output

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatTable  = "table"
	FormatJSON   = "json"
	FormatPretty = "pretty"
)

Format types

View Source
const SensitiveOverlay = "********"

SensitiveOverlay is the string used to hide sensitive information

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	// Format formats the data and writes it to the writer
	Format(data interface{}) error
}

Formatter is the interface for output formatting

func NewFormatter

func NewFormatter(format string, opts Options) (Formatter, error)

NewFormatter creates a formatter based on the format type

type JSONFormatter

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

JSONFormatter formats output as compact JSON

func NewJSONFormatter

func NewJSONFormatter(opts Options) *JSONFormatter

NewJSONFormatter creates a new JSON formatter

func (*JSONFormatter) Format

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

Format formats the data as compact JSON

type Options

type Options struct {
	Writer        io.Writer
	ShowSensitive bool
	Color         bool
}

Options for formatter configuration

type PrettyFormatter

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

PrettyFormatter formats output as indented JSON

func NewPrettyFormatter

func NewPrettyFormatter(opts Options) *PrettyFormatter

NewPrettyFormatter creates a new pretty JSON formatter

func (*PrettyFormatter) Format

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

Format formats the data as indented JSON

type TableFormatter

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

TableFormatter formats output as a table

func NewTableFormatter

func NewTableFormatter(opts Options) *TableFormatter

NewTableFormatter creates a new table formatter

func (*TableFormatter) Format

func (f *TableFormatter) Format(data any) (err error)

Jump to

Keyboard shortcuts

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