Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProgram ¶
NewProgram constructs the tea.Program for the TUI.
Types ¶
type Model ¶
type Model interface {
RefreshList(ctx context.Context) error
ListCached() []adapters.CommandSetSummary
GetCommandSet(ctx context.Context, name string) (adapters.CommandSetSummary, error)
ListVersions(ctx context.Context, name string) ([]adapters.Version, error)
ApplyVersion(ctx context.Context, name string, version int) error
DeleteVersion(ctx context.Context, name string, version int) error
Delete(ctx context.Context, name string) error
Export(ctx context.Context, name string, dest string) error
ImportSet(ctx context.Context, src string, policy string, dedupe bool) error
ImportDB(ctx context.Context, src string, overwrite bool) error
// ReopenDB forces the model to re-open the underlying DB connection and
// refresh its registry adapter. This is necessary after a full DB file
// overwrite so subsequent queries read the new file contents.
ReopenDB(ctx context.Context) error
// Close cleans up any resources held by the model (e.g., DB connections).
Close() error
UpdateCommandSet(ctx context.Context, oldName string, cs adapters.CommandSetSummary) error
ReplaceCommands(ctx context.Context, name string, cmds []string) error
// UpdateCommandSetAndReplaceCommands performs an atomic metadata+commands update
// and records a single 'update' version representing the final state.
UpdateCommandSetAndReplaceCommands(ctx context.Context, oldName string, cs adapters.CommandSetSummary) error
Run(ctx context.Context, name string, _ []string) (adapters.RunHandle, error)
Save(ctx context.Context, cs adapters.CommandSetSummary) error
Install(ctx context.Context, opts install.Options) ([]string, error)
Uninstall(ctx context.Context) ([]string, error)
}
Model defines the small subset of methods from the framework-agnostic internal UI model that the TUI depends on. This decouples presentation code from the concrete implementation and makes unit testing easier.
Named `Model` (instead of `UIModel`) to avoid redundant package/type stuttering when referenced as `ui.Model`.
type TuiModel ¶
type TuiModel struct {
// contains filtered or unexported fields
}
TuiModel is the Bubble Tea model used by cmd/tui.
func NewModel ¶
NewModel constructs the Bubble Tea TUI model used by cmd/tui. It accepts any implementation of Model (usually the framework-agnostic internal model) so tests can provide fakes.
func (*TuiModel) Init ¶
Init initializes the model by refreshing the list and populating the preview.
func (*TuiModel) IsDetailShown ¶
IsDetailShown reports detail visibility and the currently shown name (thread-safe).