output

package
v1.0.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: 11 Imported by: 0

Documentation

Overview

Package output provides output formatting adapters for CLI commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWriter

func NewWriter(w io.Writer, opts ports.OutputOptions) ports.OutputWriter

NewWriter creates an output writer for the specified format.

Types

type JSONWriter

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

JSONWriter outputs data in JSON format.

func NewJSONWriter

func NewJSONWriter(w io.Writer) *JSONWriter

NewJSONWriter creates a new JSON writer.

func (*JSONWriter) Write

func (jw *JSONWriter) Write(data any) error

Write outputs a single object as JSON.

func (*JSONWriter) WriteError

func (jw *JSONWriter) WriteError(err error) error

WriteError outputs an error as JSON.

func (*JSONWriter) WriteList

func (jw *JSONWriter) WriteList(data any, _ []ports.Column) error

WriteList outputs a list as JSON (columns are ignored).

type QuietWriter

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

QuietWriter outputs minimal data (IDs only) for scripting.

func NewQuietWriter

func NewQuietWriter(w io.Writer) *QuietWriter

NewQuietWriter creates a new quiet writer.

func (*QuietWriter) Write

func (qw *QuietWriter) Write(data any) error

Write outputs the ID or quiet field of a single object.

func (*QuietWriter) WriteError

func (qw *QuietWriter) WriteError(_ error) error

WriteError outputs nothing in quiet mode (errors go to stderr in CLI).

func (*QuietWriter) WriteList

func (qw *QuietWriter) WriteList(data any, _ []ports.Column) error

WriteList outputs IDs only, one per line.

type TableWriter

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

TableWriter outputs data in human-readable table format

func NewTableWriter

func NewTableWriter(w io.Writer, colored bool) *TableWriter

NewTableWriter creates a new table writer

func (*TableWriter) Write

func (tw *TableWriter) Write(data any) error

Write outputs a single object

func (*TableWriter) WriteError

func (tw *TableWriter) WriteError(err error) error

WriteError outputs an error message

func (*TableWriter) WriteList

func (tw *TableWriter) WriteList(data any, columns []ports.Column) error

WriteList outputs a list of objects as a table

type YAMLWriter

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

YAMLWriter outputs data in YAML format.

func NewYAMLWriter

func NewYAMLWriter(w io.Writer) *YAMLWriter

NewYAMLWriter creates a new YAML writer.

func (*YAMLWriter) Write

func (yw *YAMLWriter) Write(data any) error

Write outputs a single object as YAML.

func (*YAMLWriter) WriteError

func (yw *YAMLWriter) WriteError(err error) error

WriteError outputs an error as YAML.

func (*YAMLWriter) WriteList

func (yw *YAMLWriter) WriteList(data any, _ []ports.Column) error

WriteList outputs a list as YAML (columns are ignored).

Jump to

Keyboard shortcuts

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