printer

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONPrinter

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

JSONPrinter outputs data as indented JSON.

func NewJSONPrinter

func NewJSONPrinter(w io.Writer) *JSONPrinter

NewJSONPrinter creates a new JSON printer.

func (*JSONPrinter) Print

func (p *JSONPrinter) Print(data interface{}) error

Print outputs data as indented JSON.

func (*JSONPrinter) PrintError

func (p *JSONPrinter) PrintError(err error) error

PrintError outputs an error as JSON.

type NullPrinter added in v1.3.0

type NullPrinter struct{}

NullPrinter discards all output. Used with --quiet flag.

func NewNullPrinter added in v1.3.0

func NewNullPrinter() *NullPrinter

NewNullPrinter creates a new NullPrinter.

func (*NullPrinter) Print added in v1.3.0

func (p *NullPrinter) Print(data interface{}) error

Print discards the data.

func (*NullPrinter) PrintError added in v1.3.0

func (p *NullPrinter) PrintError(err error) error

PrintError discards the error.

type Printer

type Printer interface {
	Print(data interface{}) error
	PrintError(err error) error
}

Printer is the interface for output formatters.

func New

func New(w io.Writer, format string) Printer

New creates a new Printer based on the format string.

type TextPrinter

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

TextPrinter outputs data as human-readable text.

func NewTextPrinter

func NewTextPrinter(w io.Writer) *TextPrinter

NewTextPrinter creates a new text printer.

func (*TextPrinter) Print

func (p *TextPrinter) Print(data interface{}) error

Print outputs data as human-readable text.

func (*TextPrinter) PrintError

func (p *TextPrinter) PrintError(err error) error

PrintError outputs an error as text.

type YAMLPrinter added in v1.14.0

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

YAMLPrinter outputs data as YAML.

func NewYAMLPrinter added in v1.14.0

func NewYAMLPrinter(w io.Writer) *YAMLPrinter

NewYAMLPrinter creates a new YAML printer.

func (*YAMLPrinter) Print added in v1.14.0

func (p *YAMLPrinter) Print(data interface{}) error

Print outputs data as YAML.

func (*YAMLPrinter) PrintError added in v1.14.0

func (p *YAMLPrinter) PrintError(err error) error

PrintError outputs an error as YAML.

Jump to

Keyboard shortcuts

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