CustomPromptHandler handles non-input and enum options prompts zero-module's parameters allow prompts to specify types of custom actions this allows non-standard enum / string input to be added, such as AWS profile picker
(promptType string, params map[string]string)
| 12 | // zero-module's parameters allow prompts to specify types of custom actions |
| 13 | // this allows non-standard enum / string input to be added, such as AWS profile picker |
| 14 | func CustomPromptHandler(promptType string, params map[string]string) error { |
| 15 | switch promptType { |
| 16 | |
| 17 | case "AWSProfilePicker": |
| 18 | err := promptAWSProfilePicker(params) |
| 19 | if err != nil { |
| 20 | params["useExistingAwsProfile"] = "no" |
| 21 | return err |
| 22 | } |
| 23 | default: |
| 24 | return errors.New(fmt.Sprintf("Unsupported custom prompt type %s.", promptType)) |
| 25 | } |
| 26 | return nil |
| 27 | } |
| 28 | |
| 29 | func promptAWSProfilePicker(params map[string]string) error { |
| 30 | profiles, err := project.GetAWSProfiles() |
no test coverage detected