Documentation
¶
Index ¶
- Constants
- Variables
- func Ask(qs []*Question, t interface{}) error
- func AskOne(p Prompt, t interface{}, v Validator) error
- func Required(val interface{}) error
- type Confirm
- type ConfirmTemplateData
- type Input
- type InputTemplateData
- type MultiSelect
- type MultiSelectTemplateData
- type Password
- type Prompt
- type Question
- type Select
- type SelectTemplateData
- type Validator
Constants ¶
const ( SelectQuestionTemplate = `` /* 167-byte string literal not displayed */ // the template used to show the list of Selects SelectChoicesTemplate = `` /* 176-byte string literal not displayed */ )
Variables ¶
var ConfirmQuestionTemplate = `` /* 268-byte string literal not displayed */
Templates with Color formatting. See Documentation: https://github.com/mgutz/ansi#style-format
var ErrorTemplate = `{{color "red"}}✘ Sorry, your reply was invalid: {{.Error}}{{color "reset"}}
`
var InputQuestionTemplate = `` /* 263-byte string literal not displayed */
Templates with Color formatting. See Documentation: https://github.com/mgutz/ansi#style-format
var MultiSelectOptionsTemplate = `` /* 271-byte string literal not displayed */
var MultiSelectQuestionTemplate = `` /* 167-byte string literal not displayed */
var PasswordQuestionTemplate = `
{{- color "green+hb"}}? {{color "reset"}}
{{- color "default+hb"}}{{ .Message }} {{color "reset"}}`
Templates with Color formatting. See Documentation: https://github.com/mgutz/ansi#style-format
Functions ¶
Types ¶
type Confirm ¶
Confirm is a regular text input that accept yes/no answers.
type ConfirmTemplateData ¶
data available to the templates when processing
type Input ¶
Input is a regular text input that prints each character the user types on the screen and accepts the input with the enter key.
type InputTemplateData ¶
data available to the templates when processing
type MultiSelect ¶
type MultiSelect struct { Message string Options []string Default []string // contains filtered or unexported fields }
MultiSelect is a prompt that presents a list of various options to the user for them to select using the arrow keys and enter.
func (*MultiSelect) Cleanup ¶
func (m *MultiSelect) Cleanup(rl *readline.Instance, val interface{}) error
Cleanup removes the options section, and renders the ask like a normal question.
type MultiSelectTemplateData ¶
type MultiSelectTemplateData struct { MultiSelect Answer string Checked map[int]bool SelectedIndex int }
data available to the templates when processing
type Password ¶
type Password struct {
Message string
}
Password is like a normal Input but the text shows up as *'s and there is no default.
type Prompt ¶
type Prompt interface { Prompt(*readline.Instance) (interface{}, error) Cleanup(*readline.Instance, interface{}) error }
Prompt is the primary interface for the objects that can take user input and return a string value.
type Select ¶
type Select struct { Message string Options []string Default string // contains filtered or unexported fields }
Select is a prompt that presents a list of various options to the user for them to select using the arrow keys and enter.
type SelectTemplateData ¶
the data available to the templates when processing
type Validator ¶
type Validator func(interface{}) error
Validator is a function passed to a Question in order to redefine
func ComposeValidators ¶
ComposeValidators is a variadic function used to create one validator from many.