Documentation
¶
Index ¶
- func NormalizeSelectedRow(content string, selected lipgloss.Style) string
- func RegisterChildLoader(parentType, field string, loader ChildLoader)
- func Render(streams *iostreams.IOStreams, data any, opts ...Option) error
- func RenderForFormat(helper cmdpkg.Helper, interactive bool, outType cmdCommon.OutputFormat, ...) error
- type ChildLoader
- type ChildView
- type ChildViewMode
- type DetailContextProvider
- type DetailRenderer
- type Option
- func WithCustomTable(headers []string, rows []table.Row) Option
- func WithDetailContext(parentType string, provider DetailContextProvider) Option
- func WithDetailHelper(helper cmdpkg.Helper) Option
- func WithDetailRenderer(renderer DetailRenderer) Option
- func WithFooter(msg string) Option
- func WithInitialRowSelection(index int, openChild bool) Option
- func WithPreviewRenderer(renderer PreviewRenderer) Option
- func WithProfileName(name string) Option
- func WithRootLabel(label string) Option
- func WithRowLoader(loader RowLoader) Option
- func WithTableStretch() Option
- func WithTitle(title string) Option
- type PreviewRenderer
- type RowLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeSelectedRow ¶
NormalizeSelectedRow ensures that selected rows emitted by the table component keep the highlight active across all columns when wrapped by another style.
func RegisterChildLoader ¶
func RegisterChildLoader(parentType, field string, loader ChildLoader)
RegisterChildLoader associates a loader with a parent type and field label. Typically invoked from resource-specific packages during init.
func Render ¶
Render displays structured data using the Bubble Tea table component when the output stream is a TTY. For non-interactive streams it falls back to a static table rendering with truncated columns.
func RenderForFormat ¶
func RenderForFormat( helper cmdpkg.Helper, interactive bool, outType cmdCommon.OutputFormat, printer cli.PrintFlusher, streams *iostreams.IOStreams, display any, raw any, title string, extraOpts ...Option, ) error
RenderForFormat renders structured data according to the requested output format. For interactive output it delegates to Render, otherwise it uses the provided printer.
Types ¶
type ChildLoader ¶
ChildLoader knows how to fetch and render nested resources for a specific parent field.
type ChildView ¶
type ChildView struct {
Headers []string
Rows []table.Row
DetailRenderer DetailRenderer
Title string
ParentType string
DetailContext DetailContextProvider
Mode ChildViewMode
}
func HelperLoader ¶
func HelperLoader(headers []string, rows [][]string, detail DetailRenderer, title string) ChildView
HelperLoader is a convenience for loaders that already produce matrix data.
type ChildViewMode ¶
type ChildViewMode int
ChildViewMode determines how a child view should be presented.
const ( // ChildViewModeCollection renders the child as a tabular collection with selectable rows. ChildViewModeCollection ChildViewMode = iota // ChildViewModeDetail renders the child as another detail card view. ChildViewModeDetail )
type DetailContextProvider ¶
type DetailRenderer ¶
type Option ¶
type Option func(*config)
Option allows configuring optional behaviour for the table renderer.
func WithCustomTable ¶
WithCustomTable allows overriding the automatically generated table columns/rows. The provided headers and rows are used only for the interactive table; other formats (text/json/yaml) continue to print the original display value.
func WithDetailContext ¶
func WithDetailContext(parentType string, provider DetailContextProvider) Option
WithDetailContext provides parent objects for detail rows, enabling child loaders.
func WithDetailHelper ¶
WithDetailHelper supplies the command helper used to resolve child loaders.
func WithDetailRenderer ¶
func WithDetailRenderer(renderer DetailRenderer) Option
WithDetailRenderer enables a side-by-side detail view that updates as the table selection changes.
func WithFooter ¶
WithFooter overrides the default footer message when running interactively.
func WithInitialRowSelection ¶
WithInitialRowSelection positions the cursor on the provided row index and optionally opens the associated child view immediately when the interactive session starts.
func WithPreviewRenderer ¶
func WithPreviewRenderer(renderer PreviewRenderer) Option
WithPreviewRenderer renders a preview panel above the table that updates with the current cursor position.
func WithProfileName ¶
WithProfileName records the active configuration profile for display in the status area.
func WithRootLabel ¶
WithRootLabel sets the root segment for breadcrumb navigation.
func WithRowLoader ¶
WithRowLoader registers a loader that creates a child collection view for the currently selected row when the user presses enter. The loader should return a fully populated ChildView that mirrors the interactive resource view to display.
func WithTableStretch ¶
func WithTableStretch() Option
WithTableStretch expands the primary table to occupy the full available width.
type PreviewRenderer ¶
PreviewRenderer allows injecting a synthetic preview above the table that updates with the current cursor position.