output

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package output provides output formatting for the nuc CLI. It supports multiple output formats (table, JSON) with a common interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Label string
	Value string
}

Field represents a labeled value for single-object display.

type Format

type Format string

Format is the output format type.

const (
	// FormatTable renders human-readable tables (default for TTY).
	FormatTable Format = "table"

	// FormatJSON renders machine-readable JSON (default for pipes).
	FormatJSON Format = "json"

	// FormatYAML renders YAML output.
	FormatYAML Format = "yaml"
)

type Formatter

type Formatter interface {
	// Format renders tabular data with headers and rows.
	Format(w io.Writer, headers []string, rows [][]string) error

	// FormatSingle renders a single object as key-value pairs.
	FormatSingle(w io.Writer, fields []Field) error
}

Formatter renders structured data to a writer.

func New

func New(format string) Formatter

New creates a Formatter for the given format string. Returns a table formatter for unknown/empty format strings.

Jump to

Keyboard shortcuts

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