Documentation
¶
Overview ¶
Package output provides output formatting for CLI commands.
Index ¶
- func IsColorEnabled(noColor bool) bool
- func RenderTable(w io.Writer, headers []string, rows [][]string, colors *Colors) error
- func SimpleTable(w io.Writer, headers []string, rows [][]string) error
- func WriteJSON(w io.Writer, v any) error
- func WriteTSV(w io.Writer, headers []string, rows [][]string) error
- type Colors
- type Formatter
- type Mode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsColorEnabled ¶
IsColorEnabled returns whether color should be enabled given the flag.
func RenderTable ¶
RenderTable writes a formatted table to w. If colors are not enabled, falls back to SimpleTable. If colors enabled, uses lipgloss/table with styled headers and alternating rows.
func SimpleTable ¶
SimpleTable writes a plain table using text/tabwriter (no-color fallback).
Types ¶
type Colors ¶
Colors provides terminal color support with profile detection.
func NewColors ¶
NewColors creates a Colors instance. If noColor is true or NO_COLOR env is set, colors are disabled.
type Formatter ¶
Formatter provides a unified interface for outputting data.
func NewFormatter ¶
NewFormatter creates a formatter with the given settings.
type Mode ¶
type Mode int
Mode represents the output format mode.
func ModeFromFlags ¶
ModeFromFlags returns the output mode based on command flags. JSON takes precedence over plain.