output

package
v0.8.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format string

Format represents the output format.

const (
	FormatTable Format = "table"
	FormatJSON  Format = "json"
	FormatYAML  Format = "yaml"
)

type Printer

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

Printer handles output formatting.

func NewPrinter

func NewPrinter(format string, writer io.Writer) *Printer

NewPrinter creates a Printer for the given format string.

func (*Printer) IsRaw

func (p *Printer) IsRaw() bool

IsRaw returns true if the output format requires raw JSON/YAML.

func (*Printer) PrintJSON

func (p *Printer) PrintJSON(v interface{}) error

PrintJSON outputs a structured value as JSON or YAML.

func (*Printer) PrintMessage

func (p *Printer) PrintMessage(format string, args ...interface{})

PrintMessage prints a simple message (used across all formats).

func (*Printer) PrintRaw

func (p *Printer) PrintRaw(data []byte) error

PrintRaw outputs raw bytes as JSON or YAML.

func (*Printer) PrintTable

func (p *Printer) PrintTable(t *Table)

PrintTable prints a table using the given headers and rows.

type Table

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

Table collects headers, rows, and an optional footer, then renders them using olekukonko/tablewriter.

func NewTable

func NewTable(headers ...string) *Table

NewTable creates a new Table with the given column headers.

func (*Table) AddRow

func (t *Table) AddRow(cols ...string)

AddRow appends a row to the table.

func (*Table) Render

func (t *Table) Render(w io.Writer)

Render writes the table to w.

func (*Table) SetFooter

func (t *Table) SetFooter(format string, args ...interface{})

SetFooter sets a summary line displayed below the table.

Jump to

Keyboard shortcuts

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