(i commandInput, value *string, defaultValue string, filename string)
| 114 | } |
| 115 | |
| 116 | func 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 | |
| 137 | func inputLabel(name string) string { |
| 138 | return fmt.Sprintf("%s:", name) |
no test coverage detected