Documentation
¶
Overview ¶
Package tui owns the CLI's data-presentation contract and the theme it pushes into dry/tui at startup. Operational messaging (Info / Success / Warning / Error) is not wrapped here. Commands call the dry/tui helpers directly for those.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CLITheme ¶
CLITheme returns the safedep-cli theme. main() pushes this into dry/tui as the global default at startup, after which dry/tui Console helpers (Info / Success / Warning / Error / Print) pick it up.
Only warnings and errors carry color. Info and success render with the terminal's default foreground so routine messages do not compete visually with actionable ones.
Types ¶
type Mode ¶
type Mode string
Mode is the user-facing data-output selection. It governs only the data stream on stdout. Messaging on stderr (tui.Info/Success/...) is driven independently by dry/tui's own mode auto-detection.
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer dispatches a Renderable to stdout in the active Mode.
func NewPrinter ¶
func (*Printer) Print ¶
func (p *Printer) Print(r Renderable) error
Print writes the Renderable to stdout in the printer's active Mode. JSON bytes are written verbatim with a trailing newline appended when the renderer did not include one.
type Renderable ¶
type Renderable interface {
RenderJSON() ([]byte, error)
RenderTable() string
RenderPlain() string
}
Renderable is implemented by command results that produce structured output. Each method emits the same data in a different format. The dispatcher (Printer.Print) picks one based on the active Mode.
Lists implement the same interface. RenderTable produces a table, RenderPlain emits a line per item, RenderJSON returns the encoded array. Pre-built helpers for common shapes are not provided yet.