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

Function openUpdateEditor

internal/cli/input.go:116–135  ·  view source on GitHub ↗
(i commandInput, value *string, defaultValue string, filename string)

Source from the content-addressed store, hash-verified

114}
115
116func openUpdateEditor(i commandInput, value *string, defaultValue string, filename string) error {
117 isRequired := isInputRequired(i, true)
118 response := map[string]interface{}{}
119 input := prompt.EditorInput(i.GetName(), i.GetLabel(), i.GetHelp(), filename, defaultValue, isRequired)
120
121 if err := prompt.AskOne(input, &response); err != nil {
122 return handleInputError(err)
123 }
124
125 // Since we have BlankAllowed=true, an empty answer means we'll use the
126 // initialValue provided since this path is for the Update path.
127 answer, ok := response[i.GetName()].(string)
128 if ok && answer != "" {
129 *value = answer
130 } else {
131 *value = defaultValue
132 }
133
134 return nil
135}
136
137func inputLabel(name string) string {
138 return fmt.Sprintf("%s:", name)

Callers 1

openEditorFlagFunction · 0.85

Calls 7

EditorInputFunction · 0.92
AskOneFunction · 0.92
isInputRequiredFunction · 0.85
handleInputErrorFunction · 0.85
GetNameMethod · 0.65
GetLabelMethod · 0.65
GetHelpMethod · 0.65

Tested by

no test coverage detected