tui¶
Package tui provides interactive terminal UI components built on Bubbletea. It includes a filterable repository picker, a codespace selector with delete and back support, a work-label text input, and a generic spinner for long-running operations.
Index¶
- func RunRepoSelection(repos []string, recentCount int) (string, error)
- func RunWithSpinner(message string, task func() error) error
- func RunWithSpinnerResult[T any](message string, task func() (T, error)) (T, error)
- func Status(icon, msg string)
- func StatusErr(icon, msg string)
- type RepoModel
- func NewRepoModel(repos []string, recentCount int) RepoModel
- func (m RepoModel) Init() tea.Cmd
- func (m RepoModel) Result() RepoResult
- func (m RepoModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m RepoModel) View() string
- type RepoResult
- type SelectModel
- func NewSelectModel(codespaces []codespace.Codespace, target config.Target, dryRun, allowBack bool) SelectModel
- func (m SelectModel) Init() tea.Cmd
- func (m SelectModel) Result() SelectResult
- func (m SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m SelectModel) View() string
- type SelectResult
- type SpinnerModel
- func NewSpinnerModel(message string, task func() error) SpinnerModel
- func (m SpinnerModel) Init() tea.Cmd
- func (m SpinnerModel) Result() SpinnerResult
- func (m SpinnerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m SpinnerModel) View() string
- type SpinnerResult
- type WorkLabelModel
- func NewWorkLabelModel() WorkLabelModel
- func (m WorkLabelModel) Init() tea.Cmd
- func (m WorkLabelModel) Result() WorkLabelResult
- func (m WorkLabelModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m WorkLabelModel) View() string
- type WorkLabelResult
func RunRepoSelection¶
RunRepoSelection runs the repo selection TUI.
func RunWithSpinner¶
RunWithSpinner runs a task with a spinner, printing a success/failure line when done.
func RunWithSpinnerResult¶
RunWithSpinnerResult runs a task that returns a value, with a spinner.
func Status¶
Status prints a colored status line to stderr.
func StatusErr¶
StatusErr prints a colored error status line to stderr.
type RepoModel¶
RepoModel is the Bubbletea model for repository selection. It supports filtering by typing — the list narrows as the user types, and if the filter matches no existing repo, a "use \<filter>" option appears.
func NewRepoModel¶
NewRepoModel creates a repo selection model.
func (RepoModel) Init¶
func (RepoModel) Result¶
Result returns the repo selection result.
func (RepoModel) Update¶
func (RepoModel) View¶
type RepoResult¶
RepoResult holds the outcome of the repo selection TUI.
type SelectModel¶
SelectModel is the Bubbletea model for codespace selection.
func NewSelectModel¶
func NewSelectModel(codespaces []codespace.Codespace, target config.Target, dryRun, allowBack bool) SelectModel
NewSelectModel creates a selection model. If allowBack is true, esc/backspace signals "go back" instead of quit.
func (SelectModel) Init¶
func (SelectModel) Result¶
Result returns the selection result after the program exits.
func (SelectModel) Update¶
func (SelectModel) View¶
type SelectResult¶
SelectResult holds the outcome of the codespace selection TUI.
type SelectResult struct {
Selected *codespace.Codespace // nil means "create new"
Delete *codespace.Codespace // non-nil means user wants to delete this codespace
Quit bool
Back bool // user wants to go back to repo selection
}
type SpinnerModel¶
SpinnerModel runs a background task with a spinner.
func NewSpinnerModel¶
NewSpinnerModel creates a spinner that runs the given task in the background.
func (SpinnerModel) Init¶
func (SpinnerModel) Result¶
Result returns the spinner result.
func (SpinnerModel) Update¶
func (SpinnerModel) View¶
type SpinnerResult¶
SpinnerResult holds the outcome of a spinner task.
type WorkLabelModel¶
WorkLabelModel is the Bubbletea model for work label input.
func NewWorkLabelModel¶
NewWorkLabelModel creates a work label input model.
func (WorkLabelModel) Init¶
func (WorkLabelModel) Result¶
Result returns the work label result after the program exits.
func (WorkLabelModel) Update¶
func (WorkLabelModel) View¶
type WorkLabelResult¶
WorkLabelResult holds the outcome of the work label input TUI.
Generated by gomarkdoc