output

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
	Writer   io.Writer
	JSONMode bool
}

Formatter handles output formatting (table or JSON).

func New

func New(w io.Writer, jsonMode bool) *Formatter

New creates a new Formatter with the specified writer and JSON mode.

func (*Formatter) Print

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

Print outputs data as formatted JSON (pretty-printed) or as a simple string representation.

func (*Formatter) Table

func (f *Formatter) Table(headers []string, rows [][]string) error

Table outputs data as a formatted table or JSON array depending on mode. Headers define column names, rows contain the data.

Jump to

Keyboard shortcuts

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