Documentation
¶
Overview ¶
Package tuicore provides shared TUI form components for CLI commands.
Index ¶
- type ConfigState
- func (s *ConfigState) IsDirty(field string) bool
- func (s *ConfigState) MarkDirty(field string)
- func (s *ConfigState) UpdateAuthProviderFromForm(id string, form *FormModel)
- func (s *ConfigState) UpdateConfigFromForm(form *FormModel)
- func (s *ConfigState) UpdateProviderFromForm(id string, form *FormModel)
- type Field
- type FormModel
- type InputType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigState ¶
ConfigState holds the current configuration state and tracking for dirty fields.
func NewConfigState ¶
func NewConfigState() *ConfigState
NewConfigState creates a new state with default config.
func NewConfigStateWith ¶
func NewConfigStateWith(cfg *config.Config) *ConfigState
NewConfigStateWith creates a new state with the given config.
func (*ConfigState) IsDirty ¶
func (s *ConfigState) IsDirty(field string) bool
IsDirty checks if a field is modified.
func (*ConfigState) MarkDirty ¶
func (s *ConfigState) MarkDirty(field string)
MarkDirty marks a field as modified.
func (*ConfigState) UpdateAuthProviderFromForm ¶
func (s *ConfigState) UpdateAuthProviderFromForm(id string, form *FormModel)
UpdateAuthProviderFromForm updates a specific OIDC provider config from the form.
func (*ConfigState) UpdateConfigFromForm ¶
func (s *ConfigState) UpdateConfigFromForm(form *FormModel)
UpdateConfigFromForm updates the config based on the form fields.
func (*ConfigState) UpdateProviderFromForm ¶
func (s *ConfigState) UpdateProviderFromForm(id string, form *FormModel)
UpdateProviderFromForm updates a specific provider config from the form.
type Field ¶
type Field struct {
Key string
Label string
Description string // Help text shown below the focused field
Type InputType
Value string
Placeholder string
Options []string // For InputSelect and InputSearchSelect
Checked bool // For InputBool
Width int
Validate func(string) error
// VisibleWhen controls conditional visibility. When non-nil, the field is
// shown only when this function returns true. When nil the field is always visible.
VisibleWhen func() bool
// TextInput holds the bubbletea text input model (exported for cross-package use).
TextInput textinput.Model
Err error
// InputSearchSelect state
FilteredOptions []string // Filtered subset of Options
SelectCursor int // Cursor position in filtered list
SelectOpen bool // Whether dropdown is open
}
Field represents a single configuration field in a form.
type FormModel ¶
type FormModel struct {
Title string
Fields []*Field
Cursor int // index into VisibleFields()
Focus bool
OnSave func(map[string]interface{})
OnCancel func()
}
FormModel manages a list of fields.
func NewFormModel ¶
NewFormModel creates a new form with the given title.
func (*FormModel) AddField ¶
AddField adds a field to the form, initializing its text input if applicable.
func (FormModel) HasOpenDropdown ¶
HasOpenDropdown reports whether any field has an open search-select dropdown.
func (FormModel) VisibleFields ¶
VisibleFields returns only the fields that pass their visibility check.