output

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Out is the writer used by Print/PrintRaw. Tests swap this to a bytes.Buffer.

Functions

func Print

func Print(format string, columns []string, rows []map[string]string) error

Print is a convenience: format rows to Out.

func PrintDetail

func PrintDetail(w io.Writer, fields []Field)

PrintDetail writes a vertical key-value layout to w. Labels are right-padded to align values. Empty values are skipped.

func PrintRaw

func PrintRaw(data json.RawMessage) error

PrintRaw prints raw JSON to Out (used when --format json and we have raw API data).

Types

type CSVFormatter

type CSVFormatter struct{}

func (*CSVFormatter) Format

func (f *CSVFormatter) Format(w io.Writer, columns []string, rows []map[string]string) error

type Field

type Field struct {
	Label string
	Value string
}

Field is a label-value pair for detail output.

type Formatter

type Formatter interface {
	Format(w io.Writer, columns []string, rows []map[string]string) error
}

Formatter writes structured data to output.

func New

func New(format string) Formatter

New returns a Formatter for the given format name.

type JSONFormatter

type JSONFormatter struct{}

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(w io.Writer, columns []string, rows []map[string]string) error

type TableFormatter

type TableFormatter struct{}

func (*TableFormatter) Format

func (f *TableFormatter) Format(w io.Writer, columns []string, rows []map[string]string) error

Jump to

Keyboard shortcuts

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