Documentation
¶
Overview ¶
Package format provides pluggable CLI output renderers for backlogit commands. Callers select a renderer by Format value and write structured row data via the Renderer interface. All renderers write to an io.Writer and return an error.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
// Key is the map key used to look up the value from a row.
Key string
// Header is the column heading shown in table and tile output.
Header string
}
Column describes a single output column.
type Format ¶
type Format string
Format specifies the output format selected by the --format flag.
const ( // FormatTable renders output as a tab-separated table with a header row. FormatTable Format = "table" // FormatJSON renders output as a compact JSON array where each element // contains only the columns requested. FormatJSON Format = "json" // FormatTile renders output as blank-line-separated property-value blocks. FormatTile Format = "tile" )
type JSONRenderer ¶
type JSONRenderer struct{}
JSONRenderer renders rows as a JSON array. Each element contains only the keys present in the supplied columns slice.
func NewJSONRenderer ¶
func NewJSONRenderer() *JSONRenderer
NewJSONRenderer returns a ready-to-use JSONRenderer.
type TableRenderer ¶
type TableRenderer struct{}
TableRenderer renders rows as a tab-separated table using tabwriter. The first row is a header containing column headings.
func NewTableRenderer ¶
func NewTableRenderer() *TableRenderer
NewTableRenderer returns a ready-to-use TableRenderer.
type TileRenderer ¶
type TileRenderer struct {
Bold bool
}
TileRenderer renders rows as blank-line-separated property-value blocks. Each block contains one "Header: value" line per column. Bold controls whether ANSI bold escape sequences are applied to the first property line of each block. Callers set Bold based on TTY detection; the renderer does not auto-detect terminal capabilities.
func NewTileRenderer ¶
func NewTileRenderer(bold bool) *TileRenderer
NewTileRenderer returns a TileRenderer with the given bold setting.