Documentation
¶
Index ¶
- func Render(data []ResponseData)
- func RenderDetails(data []ResponseData)
- func RenderStatic(data []ResponseData)
- func ValidateOutputSelection() error
- type BubbleTeaRenderer
- type CSVRenderer
- type DetailFielder
- type DetailView
- type DetailViewer
- type Format
- type JSONRenderer
- type Renderer
- type ResponseData
- type TableRenderer
- type YAMLRenderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶ added in v1.5.4
func Render(data []ResponseData)
Render renders the data using the appropriate renderer
func RenderDetails ¶ added in v1.7.0
func RenderDetails(data []ResponseData)
RenderDetails renders a single resource opening the details sheet directly in the interactive view (the `get` case). Structured formats (-o json/yaml/ csv) and non-TTY runs fall back to the regular renderer.
func RenderStatic ¶ added in v1.6.3
func RenderStatic(data []ResponseData)
RenderStatic renders data without the interactive table.
func ValidateOutputSelection ¶ added in v1.6.3
func ValidateOutputSelection() error
ValidateOutputSelection checks the output-related flags up front so commands fail fast with a clear message (and a non-zero exit) instead of silently falling back or erroring deep in the render path. It rejects an unknown --output value, a --query used with a non-structured format, and a malformed JMESPath expression.
Types ¶
type BubbleTeaRenderer ¶ added in v1.5.4
type BubbleTeaRenderer struct{}
BubbleTeaRenderer renders ResponseData using Bubble Tea
func (BubbleTeaRenderer) Render ¶ added in v1.5.4
func (btr BubbleTeaRenderer) Render(data []ResponseData)
type CSVRenderer ¶ added in v1.6.3
type CSVRenderer struct{}
func (CSVRenderer) Render ¶ added in v1.6.3
func (cr CSVRenderer) Render(data []ResponseData)
type DetailFielder ¶ added in v1.7.0
DetailFielder lets a ResponseData expose extra key/value pairs for the interactive details view, beyond the compact TableRow columns.
type DetailView ¶ added in v1.7.0
type DetailView struct {
Title string // table title, e.g. "User Data"
Noun string // footer noun, e.g. "entries"
DetailPrefix string // details title prefix, e.g. "User Data"
TitleKey string // field naming the details view, e.g. "ID"
FieldOrder []string // detail-only fields, in display order
}
DetailView describes how a DetailFielder resource is titled in the interactive views, and in which order its detail-only fields appear after the table columns.
type DetailViewer ¶ added in v1.7.0
type DetailViewer interface {
DetailView() DetailView
}
DetailViewer optionally lets a DetailFielder describe its own view labels.
type Format ¶ added in v1.6.3
type Format string
Format is the output format selected for a command's results. table is the human-facing default; json, yaml and csv are the machine-readable formats meant for automation, piping and (in the future) an MCP server.
func ParseFormat ¶ added in v1.6.3
ParseFormat normalizes a user-supplied format string. ok is false for an unrecognized value so callers can surface an actionable error.
func ResolveFormat ¶ added in v1.6.3
func ResolveFormat() Format
ResolveFormat determines the active output format.
Precedence: an explicit --output flag > --json shortcut > env (LSH_OUTPUT) > config > default. An explicit --output always wins — including -o table over --json — which is why callers record whether the flag was set via the "output_explicit" key (viper.GetString alone can't tell an explicit `-o table` from the "table" default).
func (Format) IsStructured ¶ added in v1.6.3
IsStructured reports whether the format produces machine-readable, queryable output. Only structured formats support the --query (JMESPath) flag.
type JSONRenderer ¶
type JSONRenderer struct{}
func (JSONRenderer) Render ¶
func (jr JSONRenderer) Render(data []ResponseData)
type Renderer ¶
type Renderer interface {
Render(data []ResponseData)
}
func GetRenderer ¶ added in v1.5.4
func GetRenderer() Renderer
GetRenderer returns the renderer for the active output format.
Structured formats (json/yaml/csv) are honored everywhere, including when stdout is piped — that is the whole point of automation output. The table format additionally chooses between the classic ASCII writer (for CI / LSH_CLASSIC_OUTPUT / non-TTY pipes) and the interactive Bubble Tea view.
func GetStaticRenderer ¶ added in v1.6.3
func GetStaticRenderer() Renderer
GetStaticRenderer is like GetRenderer but never returns the interactive Bubble Tea view. Use it for flows where taking over the terminal is wrong — e.g. a `--wait` that must print the resource and then keep streaming progress.
type ResponseData ¶
type ResponseData interface {
TableRow() outputTable.Row
}
type TableRenderer ¶
type TableRenderer struct{}
func (TableRenderer) Render ¶
func (tr TableRenderer) Render(data []ResponseData)
type YAMLRenderer ¶ added in v1.6.3
type YAMLRenderer struct{}
func (YAMLRenderer) Render ¶ added in v1.6.3
func (yr YAMLRenderer) Render(data []ResponseData)