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.
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).
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
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.