(i commandInput, value interface{}, options []string, defaultValue *string, isUpdate bool)
| 72 | } |
| 73 | |
| 74 | func _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 | |
| 99 | func openCreateEditor(value *string, defaultValue string, filename string, infoFn func(), tempFileFn func(string)) error { |
| 100 | out, err := prompt.CaptureInputViaEditor( |
no test coverage detected