Documentation
¶
Overview ¶
Package tui provides a terminal user interface for apimgr
Package tui provides a terminal user interface for apimgr
Index ¶
- Constants
- func FormHints() []string
- func FormInputs() []textinput.Model
- func FormLabels() []string
- func NextFormField(inputs []textinput.Model, currentFocus int) int
- func PrevFormField(inputs []textinput.Model, currentFocus int) int
- func RenderForm(inputs []textinput.Model, focusIndex int, title string, errorMsg string) string
- func Run() error
- func SetFormData(inputs []textinput.Model, data FormData)
- type CompatCheck
- type CompatResultMsg
- type CompatTestResult
- type ConfigAddedMsg
- type ConfigDeletedMsg
- type ConfigSwitchedMsg
- type ConfigUpdatedMsg
- type ConfigsLoadedMsg
- type FormData
- type KeyMap
- type Model
- func (m Model) Init() tea.Cmd
- func (m Model) RenderCompatResultView() string
- func (m Model) RenderCompatTestingView() string
- func (m Model) RenderDeleteConfirm() string
- func (m Model) RenderDetailView() string
- func (m Model) RenderFormView() string
- func (m Model) RenderFormViewFull() string
- func (m Model) RenderHelpView() string
- func (m Model) RenderMainView() string
- func (m Model) RenderModelSelectView() string
- func (m Model) RenderPingResultView() string
- func (m Model) RenderPingTestingView() string
- func (m Model) RenderStatusBar() string
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() string
- type ModelSwitchedMsg
- type PingResultMsg
- type SwitchType
- type TestResult
- type ViewState
Constants ¶
const ( FormFieldAlias = iota FormFieldAPIKey FormFieldAuthToken FormFieldBaseURL FormFieldModel FormFieldModels FormFieldCount // Total number of fields )
FormField represents the index of each form field
Variables ¶
This section is empty.
Functions ¶
func FormInputs ¶
FormInputs creates and initializes form input fields Requirements: 5.2, 6.2
func NextFormField ¶
NextFormField moves focus to the next form field
func PrevFormField ¶
PrevFormField moves focus to the previous form field
func RenderForm ¶
RenderForm renders the form view with inputs Requirements: 5.2, 6.2
func SetFormData ¶
SetFormData populates form inputs with existing data Requirements: 6.2
Types ¶
type CompatCheck ¶
CompatCheck represents a single compatibility check result
type CompatResultMsg ¶
type CompatResultMsg struct {
Result *compatibility.TestResult
Err error
}
CompatResultMsg is sent when compatibility test completes
type CompatTestResult ¶
type CompatTestResult struct {
Success bool
CompatibilityLevel string // "full", "partial", "none"
Checks []CompatCheck
ResponseTime string
Error string
}
CompatTestResult holds compatibility test result data
type ConfigAddedMsg ¶
ConfigAddedMsg is sent when a config is added
type ConfigDeletedMsg ¶
ConfigDeletedMsg is sent when a config is deleted
type ConfigSwitchedMsg ¶
type ConfigSwitchedMsg struct {
Alias string
IsLocal bool // true for local switch, false for global switch
Err error
}
ConfigSwitchedMsg is sent when active config is switched
type ConfigUpdatedMsg ¶
ConfigUpdatedMsg is sent when a config is updated
type ConfigsLoadedMsg ¶
ConfigsLoadedMsg is sent when configs are loaded
type FormData ¶
type FormData struct {
Alias string
APIKey string
AuthToken string
BaseURL string
Model string
Models string // Comma-separated list of models
}
FormData represents the data collected from the form Requirements: 5.3, 5.4, 6.3, 6.4
func GetFormData ¶
GetFormData extracts FormData from form inputs
func (*FormData) ParseModels ¶
ParseModels parses the comma-separated models string into a slice
type KeyMap ¶
type KeyMap struct {
Up key.Binding // k - move up
Down key.Binding // j - move down
Top key.Binding // g - jump to top
Bottom key.Binding // G - jump to bottom
Select key.Binding // Enter - select
SwitchLocal key.Binding // s - switch local (Claude Code only)
SwitchGlobal key.Binding // S - switch global active config
Add key.Binding // a - add config
Edit key.Binding // e - edit config
Delete key.Binding // d - delete config
Ping key.Binding // p - ping test
Test key.Binding // t - compatibility test
Model key.Binding // m - switch model
Help key.Binding // ? - help
Quit key.Binding // q - quit
Cancel key.Binding // Esc - cancel
Confirm key.Binding // Enter - confirm (in form)
}
KeyMap defines all keyboard shortcuts
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the core state model for TUI
func (Model) RenderCompatResultView ¶
RenderCompatResultView renders the compatibility test result view Requirements: 9.3, 9.4, 11.2
func (Model) RenderCompatTestingView ¶
RenderCompatTestingView renders the compatibility testing in progress view Requirements: 9.2, 11.2
func (Model) RenderDeleteConfirm ¶
RenderDeleteConfirm renders the delete confirmation dialog Requirements: 7.1, 7.2, 11.2
func (Model) RenderDetailView ¶
RenderDetailView renders the detail view Requirements: 3.1, 3.2, 3.3, 3.4, 11.2
func (Model) RenderFormView ¶
RenderFormView renders the form view (add/edit)
func (Model) RenderFormViewFull ¶
RenderFormViewFull renders the complete form view Requirements: 5.2, 6.2
func (Model) RenderHelpView ¶
RenderHelpView renders the help panel with scrolling support Requirements: 10.2, 10.3, 10.4, 11.2
func (Model) RenderMainView ¶
RenderMainView renders the main list view Requirements: 11.1, 11.2, 11.3
func (Model) RenderModelSelectView ¶
RenderModelSelectView renders the model selection view Requirements: 12.1, 12.2, 11.3
func (Model) RenderPingResultView ¶
RenderPingResultView renders the ping test result view Requirements: 8.3, 8.4, 11.2
func (Model) RenderPingTestingView ¶
RenderPingTestingView renders the ping testing in progress view Requirements: 8.2, 11.2
func (Model) RenderStatusBar ¶
RenderStatusBar renders the bottom status bar
type ModelSwitchedMsg ¶
ModelSwitchedMsg is sent when model is switched
type PingResultMsg ¶
PingResultMsg is sent when ping test completes
type SwitchType ¶
type SwitchType int
SwitchType represents the type of switch operation
const ( SwitchTypeNone SwitchType = iota SwitchTypeLocal SwitchTypeGlobal )
type TestResult ¶
TestResult holds test result data
type ViewState ¶
type ViewState int
ViewState represents the current view state
const ( ViewMain ViewState = iota // Main list view ViewDetail // Detail view ViewAdd // Add config form ViewEdit // Edit config form ViewDelete // Delete confirmation dialog ViewHelp // Help panel ViewModelSelect // Model selection list ViewPingTesting // Ping test in progress ViewPingResult // Ping test result ViewCompatTesting // Compatibility test in progress ViewCompatResult // Compatibility test result )