MCPcopy Create free account
hub / github.com/auth0/auth0-cli / _select

Function _select

internal/cli/input.go:74–97  ·  view source on GitHub ↗
(i commandInput, value interface{}, options []string, defaultValue *string, isUpdate bool)

Source from the content-addressed store, hash-verified

72}
73
74func _select(i commandInput, value interface{}, options []string, defaultValue *string, isUpdate bool) error {
75 isRequired := isInputRequired(i, isUpdate)
76
77 // If there is no provided default value, we'll use the first option in
78 // the selector by default.
79 if defaultValue == nil && len(options) > 0 {
80 defaultValue = &(options[0])
81 }
82
83 var input *survey.Question
84
85 // Use paginated select for large option sets (>15 options).
86 if len(options) > 15 {
87 input = prompt.PaginatedSelectInput("", i.GetLabel(), i.GetHelp(), options, auth0.StringValue(defaultValue), isRequired)
88 } else {
89 input = prompt.SelectInput("", i.GetLabel(), i.GetHelp(), options, auth0.StringValue(defaultValue), isRequired)
90 }
91
92 if err := prompt.AskOne(input, value); err != nil {
93 return handleInputError(err)
94 }
95
96 return nil
97}
98
99func openCreateEditor(value *string, defaultValue string, filename string, infoFn func(), tempFileFn func(string)) error {
100 out, err := prompt.CaptureInputViaEditor(

Callers 2

selectFlagFunction · 0.85
PickMethod · 0.85

Calls 7

PaginatedSelectInputFunction · 0.92
SelectInputFunction · 0.92
AskOneFunction · 0.92
isInputRequiredFunction · 0.85
handleInputErrorFunction · 0.85
GetLabelMethod · 0.65
GetHelpMethod · 0.65

Tested by

no test coverage detected