Documentation ¶
Index ¶
- type Item
- type PromptResult
- func (pr *PromptResult) Ask(question string, validator ValidateFunc) Prompter
- func (pr *PromptResult) AskRepeat(question string, validator ValidateFunc, prompts ...func(result any) Prompter) Prompter
- func (pr *PromptResult) Confirm(question string, defaultValue rune) Prompter
- func (pr *PromptResult) Fill(ptr any) Prompter
- func (pr *PromptResult) MultiSelect(label string, allItems []*Item, selectedPos int) Prompter
- func (pr *PromptResult) Select(label string, items []string) Prompter
- func (pr *PromptResult) When(cb func(result interface{}) bool, thenPrompt func(prompt Prompter) Prompter) Prompter
- type PromptResultType
- type Prompter
- func Ask(question string, validator ValidateFunc) Prompter
- func AskRecurring(question string, validator ValidateFunc, prompts ...func(result any) Prompter) Prompter
- func Confirm(question string, defaultVal rune) Prompter
- func MultiSelect(label string, allItems []*Item, selectedPos int) Prompter
- func Select(label string, items []string) Prompter
- type ValidateFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PromptResult ¶
type PromptResult struct { Type PromptResultType ShouldAskNext bool Result interface{} Error error }
func (*PromptResult) Ask ¶
func (pr *PromptResult) Ask(question string, validator ValidateFunc) Prompter
func (*PromptResult) AskRepeat ¶
func (pr *PromptResult) AskRepeat(question string, validator ValidateFunc, prompts ...func(result any) Prompter) Prompter
func (*PromptResult) Confirm ¶
func (pr *PromptResult) Confirm(question string, defaultValue rune) Prompter
func (*PromptResult) Fill ¶
func (pr *PromptResult) Fill(ptr any) Prompter
func (*PromptResult) MultiSelect ¶
func (pr *PromptResult) MultiSelect(label string, allItems []*Item, selectedPos int) Prompter
type PromptResultType ¶
type PromptResultType int
const ( PromptResultTypeNormal PromptResultType = iota PromptResultTypeBoolean PromptResultTypeRecurring PromptResultTypeSelect PromptResultTypeMultiSelect )
type Prompter ¶
type Prompter interface { Ask(question string, validator ValidateFunc) Prompter Confirm(question string, defaultValue rune) Prompter AskRepeat(question string, validator ValidateFunc, prompts ...func(result any) Prompter) Prompter Select(label string, items []string) Prompter MultiSelect(label string, items []*Item, selectedPos int) Prompter When(cb func(result interface{}) bool, thenPrompt func(prompt Prompter) Prompter) Prompter Fill(ptr any) Prompter }
func Ask ¶
func Ask(question string, validator ValidateFunc) Prompter
func AskRecurring ¶
func AskRecurring(question string, validator ValidateFunc, prompts ...func(result any) Prompter) Prompter
func MultiSelect ¶
MultiSelect() prompts user to select one or more items in the given slice
type ValidateFunc ¶
Click to show internal directories.
Click to hide internal directories.