output

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintTable

func PrintTable(w io.Writer, headers []string, rows [][]string)

PrintTable writes a styled table to the given writer using lipgloss.

Types

type Envelope

type Envelope struct {
	Version   string    `json:"version"`
	Command   string    `json:"command"`
	Timestamp time.Time `json:"timestamp"`
	Success   bool      `json:"success"`
	Results   any       `json:"results"`
	Summary   any       `json:"summary,omitempty"`
	Errors    []string  `json:"errors,omitempty"`
}

Envelope is the standard JSON output envelope.

func NewEnvelope

func NewEnvelope(command string, results any) *Envelope

NewEnvelope creates a new output envelope.

type Formatter

type Formatter interface {
	// Format writes the given data to the output.
	Format(data any) error
	// Writer returns the underlying writer.
	Writer() io.Writer
}

Formatter is the interface for output formatting.

func New

func New(mode string) Formatter

New creates a formatter for the given output mode.

type JSONFormatter

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

JSONFormatter outputs JSON.

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(data any) error

func (*JSONFormatter) Writer

func (f *JSONFormatter) Writer() io.Writer

type PlainFormatter

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

PlainFormatter outputs plain text, one item per line.

func (*PlainFormatter) Format

func (f *PlainFormatter) Format(data any) error

func (*PlainFormatter) Writer

func (f *PlainFormatter) Writer() io.Writer

type TableFormatter

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

TableFormatter outputs human-readable tables.

func (*TableFormatter) Format

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

func (*TableFormatter) Writer

func (f *TableFormatter) Writer() io.Writer

Jump to

Keyboard shortcuts

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