Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderKeyBindings ¶
func RenderKeyBindings(keys []KeyBinding, width int) string
RenderKeyBindings generates an instruction line for the supplied key bindings.
Types ¶
type FieldOption ¶
type FieldOption func(*FormField)
FieldOption can be used to apply common changes to a set of fields.
var VerbosePrompts FieldOption = func(field *FormField) { field.verbose = true }
VerbosePrompts is an option to enable verbose field prompts.
type FormField ¶
type FormField struct {
Prompt string
PromptVerbose string
Placeholder string
LoadingMessage string
Instructions []string
InputOnSameLine bool
Choices []string
Completions form.Completions
// contains filtered or unexported fields
}
FormField is used to create new form fields with more consistency.
func (FormField) NewChoiceField ¶
func (f FormField) NewChoiceField(opts ...FieldOption) form.ChoiceField
NewChoiceField creates a new single choice form field from the current state of this field spec.
func (FormField) NewExitField ¶
func (f FormField) NewExitField(opts ...FieldOption) form.ExitField
NewExitField creates a field that trigger an exit as soon as it is focused.
func (FormField) NewMultiChoiceField ¶
func (f FormField) NewMultiChoiceField(opts ...FieldOption) form.MultiChoiceField
NewMultiChoiceField creates a new multiple choice form field from the current state of this field spec.
func (FormField) NewTextField ¶
func (f FormField) NewTextField(opts ...FieldOption) form.TextField
NewTextField creates a new text form field from the current state of this field spec.
type KeyBinding ¶
type KeyBinding struct {
// The key bound to the action.
Key tea.Key
// The description of the action.
Desc string
}
KeyBinding represents a description of what a key should do.