MCPcopy Create free account
hub / github.com/commitdev/zero / CustomPromptHandler

Function CustomPromptHandler

internal/init/custom-prompts.go:14–27  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
14func 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
29func promptAWSProfilePicker(params map[string]string) error {
30 profiles, err := project.GetAWSProfiles()

Callers 1

RunPromptMethod · 0.85

Calls 1

promptAWSProfilePickerFunction · 0.85

Tested by

no test coverage detected