Documentation
¶
Index ¶
- Variables
- func Ask(inputs []*survey.Question, response interface{}) error
- func AskBool(message string, value *bool, defaultValue bool) error
- func AskMultiSelect(message string, response interface{}, options ...string) error
- func AskMultiSelectWithPageSize(message string, response interface{}, pageSize int, options ...string) error
- func AskOne(input *survey.Question, response interface{}) error
- func BoolInput(name string, message string, help string, defaultValue bool, required bool) *survey.Question
- func CaptureInputViaEditor(contents, pattern string, infoFn func(), fileCreatedFn func(string)) (result string, err error)
- func Confirm(message string) bool
- func ConfirmWithDefault(message string, defaultValue bool) bool
- func EditorInput(name string, message string, help string, filename string, defaultValue string, ...) *survey.Question
- func PaginatedSelectInput(name string, message string, help string, options []string, ...) *survey.Question
- func PasswordInput(name string, message string, required bool) *survey.Question
- func SelectInput(name string, message string, help string, options []string, ...) *survey.Question
- func TextInput(name string, message string, help string, defaultValue string, required bool) *survey.Question
- type Editor
- type EditorTemplateData
Constants ¶
This section is empty.
Variables ¶
var EditorQuestionTemplate = `` /* 714-byte string literal not displayed */
var Icons = survey.WithIcons(func(icons *survey.IconSet) {
icons.Question.Text = ""
})
Functions ¶
func AskMultiSelect ¶ added in v1.4.0
func AskMultiSelectWithPageSize ¶
func AskMultiSelectWithPageSize(message string, response interface{}, pageSize int, options ...string) error
AskMultiSelectWithPageSize is like AskMultiSelect but shows at most pageSize options at a time, letting the user scroll/page through longer lists (e.g. when a feature flag has more variations than fit on screen). A pageSize <= 0 falls back to survey's default page size.
func CaptureInputViaEditor ¶ added in v0.3.0
func CaptureInputViaEditor(contents, pattern string, infoFn func(), fileCreatedFn func(string)) (result string, err error)
CaptureInputViaEditor is the high level function to use in this package in order to capture input from an editor.
The arguments have been tailored for our use of strings mostly in the rest of the CLI even though internally we're using []byte.
func Confirm ¶
Confirm prompts the user with a yes/no question and returns their response. On EOF (e.g. piped input or --no-input mode) it returns false.
func ConfirmWithDefault ¶ added in v1.31.0
ConfirmWithDefault prompts with the given default value (Y/n when true, y/N when false). On EOF (e.g. --no-input mode) the default value is returned instead of false.