Documentation
¶
Overview ¶
Package tui implements the interactive terminal UI using Bubble Tea.
Architecture: The TUI follows Bubble Tea's Elm-like pattern (Model → Update → View). AppModel is the top-level model that manages four tab sub-models (Create, Connect, Edit, Delete) and an optional passphrase modal overlay. Each sub-model handles its own input and rendering, while AppModel coordinates tab switching, saves, and result propagation back to the CLI layer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionKind ¶
type ActionKind int
ActionKind describes what action the user took in the TUI.
const ( ActionNone ActionKind = iota // user quit without action ActionConnect // user selected a connection ActionCreated // user submitted the new connection form ActionEdited // user submitted the edit form (password changed, needs modal) )
type AppModel ¶
type AppModel struct {
// contains filtered or unexported fields
}
AppModel is the top-level Bubble Tea model.
type AppResult ¶
type AppResult struct {
Action ActionKind
Connection *model.Connection
WizardResult *WizardResult
}
AppResult is returned from the TUI to the CLI layer.
type ConnectModel ¶
type ConnectModel struct {
// contains filtered or unexported fields
}
ConnectModel is the Bubble Tea model for the Connect tab.
func (*ConnectModel) AddItem ¶
func (m *ConnectModel) AddItem(conn model.Connection)
AddItem inserts a connection in ascending alphabetical position.
func (*ConnectModel) RemoveByName ¶
func (m *ConnectModel) RemoveByName(name string)
RemoveByName removes the first item matching the given connection name.
func (*ConnectModel) SetSize ¶
func (m *ConnectModel) SetSize(w, h int)
func (ConnectModel) Update ¶
func (m ConnectModel) Update(msg tea.Msg) (ConnectModel, *AppResult, tea.Cmd)
func (ConnectModel) View ¶
func (m ConnectModel) View() string
type CreateModel ¶
type CreateModel struct {
// contains filtered or unexported fields
}
CreateModel is the Bubble Tea model for the New tab.
func (*CreateModel) SetSize ¶
func (m *CreateModel) SetSize(w, h int)
func (CreateModel) Update ¶
func (m CreateModel) Update(msg tea.Msg) (CreateModel, *AppResult, tea.Cmd)
func (CreateModel) View ¶
func (m CreateModel) View() string
type DeleteModel ¶
type DeleteModel struct {
// contains filtered or unexported fields
}
DeleteModel is the Bubble Tea model for the Delete tab. Deletion requires pressing Enter 3 times on the same item within a 1-second window. Moving the cursor or letting the timer expire resets the count.
func (*DeleteModel) AddItem ¶
func (m *DeleteModel) AddItem(conn model.Connection)
AddItem inserts a connection in ascending alphabetical position.
func (*DeleteModel) RemoveByName ¶
func (m *DeleteModel) RemoveByName(name string)
RemoveByName removes the first item matching the given connection name.
func (*DeleteModel) SetSize ¶
func (m *DeleteModel) SetSize(w, h int)
func (DeleteModel) Update ¶
func (m DeleteModel) Update(msg tea.Msg) (DeleteModel, *AppResult, tea.Cmd)
func (DeleteModel) View ¶
func (m DeleteModel) View() string
type EditModel ¶
type EditModel struct {
// contains filtered or unexported fields
}
EditModel is the Bubble Tea model for the Edit tab. It has two modes: list mode (select a connection) and form mode (edit fields).
func (*EditModel) AddItem ¶
func (m *EditModel) AddItem(conn model.Connection)
AddItem inserts a connection in ascending alphabetical position.
func (*EditModel) RemoveByName ¶
RemoveByName removes the first item matching the given connection name.
type FilterBox ¶
type FilterBox struct {
// contains filtered or unexported fields
}
FilterBox is a reusable search input rendered inside a bordered box.
type PassphraseModal ¶
type PassphraseModal struct {
// contains filtered or unexported fields
}
PassphraseModal is a Bubble Tea sub-model rendered as a centered overlay. It has two modes: "create" (first-time setup, two fields with confirmation) and "enter" (subsequent use, single field). When active, it captures all keyboard input, preventing interaction with the underlying tab.
func (*PassphraseModal) SetSize ¶
func (m *PassphraseModal) SetSize(w, h int)
func (PassphraseModal) Update ¶
func (m PassphraseModal) Update(msg tea.Msg) (PassphraseModal, *PassphraseResult, tea.Cmd)
func (PassphraseModal) View ¶
func (m PassphraseModal) View() string
type PassphraseResult ¶
PassphraseResult is returned when the user submits or cancels the modal.