Documentation
¶
Index ¶
- Variables
- func NotEmpty(value string) error
- type ErrValueNotAccepted
- type Field
- type ListField
- func (f ListField) ID() string
- func (f ListField) IsDone() bool
- func (f ListField) SetBlur() Field
- func (f ListField) SetFocus() (Field, tea.Cmd)
- func (f ListField) SubmitValue() (Field, error)
- func (f ListField) Update(msg tea.Msg) (Field, tea.Cmd)
- func (f ListField) UpdateRequestParams(p advisory.RequestParams) advisory.RequestParams
- func (f ListField) Value() string
- func (f ListField) View() string
- type ListFieldConfiguration
- type TextField
- func (f TextField) ID() string
- func (f TextField) IsDone() bool
- func (f TextField) SetBlur() Field
- func (f TextField) SetFocus() (Field, tea.Cmd)
- func (f TextField) SubmitValue() (Field, error)
- func (f TextField) Update(msg tea.Msg) (Field, tea.Cmd)
- func (f TextField) UpdateRequestParams(p advisory.RequestParams) advisory.RequestParams
- func (f TextField) Value() string
- func (f TextField) View() string
- type TextFieldConfiguration
- type TextValidationRule
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrValueNotInAllowedSet = errors.New("value not in allowed set")
Functions ¶
Types ¶
type ErrValueNotAccepted ¶
func (ErrValueNotAccepted) Error ¶
func (e ErrValueNotAccepted) Error() string
type ListField ¶
type ListField struct {
// contains filtered or unexported fields
}
func NewListField ¶
func NewListField(cfg ListFieldConfiguration) ListField
func (ListField) SubmitValue ¶
func (ListField) UpdateRequestParams ¶ added in v0.33.0
func (f ListField) UpdateRequestParams(p advisory.RequestParams) advisory.RequestParams
type ListFieldConfiguration ¶
type ListFieldConfiguration struct {
// ID is a unique identifier for the field.
ID string
Prompt string
Options []string
RequestParamsUpdater func(value string, p advisory.RequestParams) advisory.RequestParams
}
type TextField ¶
type TextField struct {
// contains filtered or unexported fields
}
func NewTextField ¶
func NewTextField(cfg TextFieldConfiguration) TextField
func (TextField) SubmitValue ¶
func (TextField) UpdateRequestParams ¶ added in v0.33.0
func (f TextField) UpdateRequestParams(p advisory.RequestParams) advisory.RequestParams
type TextFieldConfiguration ¶
type TextFieldConfiguration struct {
// ID is a unique identifier for the field.
ID string
// Prompt is the text shown before the input field. (E.g. "Name: ")
Prompt string
// RequestParamsUpdater is a function that updates the advisory request with the
// current field value.
RequestParamsUpdater func(value string, p advisory.RequestParams) advisory.RequestParams
// AllowedValues is a list of values that are allowed to be entered and are used
// as suggestions when the user starts typing.
AllowedValues []string
// DefaultSuggestion is the value that is shown as a suggestion when the user
// hasn't entered anything.
DefaultSuggestion string
// EmptyValueHelpMsg is the help message shown when the user hasn't entered
// anything and there are no suggestions.
EmptyValueHelpMsg string
// NoMatchHelpMsg is the help message shown when the user has entered something
// but there are no matching suggestions.
NoMatchHelpMsg string
// ValidationRules is a list of validation rules that are run when the user
// submits the field. All rules must pass for the field to be valid.
ValidationRules []TextValidationRule
}
type TextValidationRule ¶
Click to show internal directories.
Click to hide internal directories.