Documentation
¶
Index ¶
- 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 PasswordTemplateData
- type Prompt
- type Question
- type Select
- type SelectTemplateData
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ConfirmQuestionTemplate = `` /* 497-byte string literal not displayed */
Templates with Color formatting. See Documentation: https://github.com/mgutz/ansi#style-format
var InputQuestionTemplate = `` /* 496-byte string literal not displayed */
Templates with Color formatting. See Documentation: https://github.com/mgutz/ansi#style-format
var MultiSelectQuestionTemplate = `` /* 787-byte string literal not displayed */
var PageSize = 7
PageSize is the default maximum number of items to show in select/multiselect prompts
var PasswordQuestionTemplate = `` /* 318-byte string literal not displayed */
Templates with Color formatting. See Documentation: https://github.com/mgutz/ansi#style-format
var SelectQuestionTemplate = `` /* 647-byte string literal not displayed */
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 { core.Renderer Message string Options []string Default []string Help string PageSize int // 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(val interface{}) error
Cleanup removes the options section, and renders the ask like a normal question.
func (*MultiSelect) OnChange ¶
func (m *MultiSelect) OnChange(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)
OnChange is called on every keypress.
func (*MultiSelect) Prompt ¶
func (m *MultiSelect) Prompt() (interface{}, error)
type MultiSelectTemplateData ¶
type MultiSelectTemplateData struct { MultiSelect Answer string ShowAnswer bool Checked map[string]bool SelectedIndex int ShowHelp bool PageEntries []string }
data available to the templates when processing
type Password ¶
Password is like a normal Input but the text shows up as *'s and there is no default.
type PasswordTemplateData ¶ added in v1.1.1
type Prompt ¶
type Prompt interface { Prompt() (interface{}, error) Cleanup(interface{}) error Error(error) error }
Prompt is the primary interface for the objects that can take user input and return a string value.
type Select ¶
type Select struct { core.Renderer Message string Options []string Default string Help string PageSize int // 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 ¶
type SelectTemplateData struct { Select PageEntries []string SelectedIndex int Answer string ShowAnswer bool ShowHelp bool }
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.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
autoplay
////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/ask.go go run ask.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/confirm.go go run confirm.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/doubleSelect.go go run doubleSelect.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/help.go go run help.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/input.go go run input.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/multiselect.go go run multiselect.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/password.go go run password.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/select.go go run select.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/selectThenInput.go go run selectThenInput.go //////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/ask.go go run ask.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/confirm.go go run confirm.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/doubleSelect.go go run doubleSelect.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/help.go go run help.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/input.go go run input.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/multiselect.go go run multiselect.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/password.go go run password.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/select.go go run select.go ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DO NOT MODIFY THIS FILE! This file was automatically generated via the commands: go get github.com/coryb/autoplay autoplay -n autoplay/selectThenInput.go go run selectThenInput.go ////////////////////////////////////////////////////////////////////////////// |