Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PagerInstructions ¶
func PagerInstructions(keys []KeyBinding) func(width int) string
PagerInstructions returns a nano-style instructions bar for the pager.
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.
func GlobalInstructions ¶
func GlobalInstructions(ins ...interface{}) FieldOption
GlobalInstructions appends the supplied instructions to every field.
type FormField ¶
type FormField struct { Prompt string PromptVerbose string Placeholder string LoadingMessage string Instructions []interface{} 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 triggers 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.