(promptMsg string)
| 124 | } |
| 125 | |
| 126 | func promptForExistingEnvName(promptMsg string) string { |
| 127 | configuredEnvNames, err := listConfiguredEnvNames() |
| 128 | if err != nil { |
| 129 | exit.Error(err) |
| 130 | } |
| 131 | |
| 132 | fmt.Printf("your currently configured environments are: %s\n\n", strings.Join(configuredEnvNames, ", ")) |
| 133 | |
| 134 | envNameContainer := &struct { |
| 135 | EnvironmentName string |
| 136 | }{} |
| 137 | |
| 138 | err = cr.ReadPrompt(envNameContainer, &cr.PromptValidation{ |
| 139 | PromptItemValidations: []*cr.PromptItemValidation{ |
| 140 | { |
| 141 | StructField: "EnvironmentName", |
| 142 | PromptOpts: &prompt.Options{ |
| 143 | Prompt: promptMsg, |
| 144 | }, |
| 145 | StringValidation: &cr.StringValidation{ |
| 146 | Required: true, |
| 147 | AllowedValues: configuredEnvNames, |
| 148 | }, |
| 149 | }, |
| 150 | }, |
| 151 | }) |
| 152 | if err != nil { |
| 153 | exit.Error(err) |
| 154 | } |
| 155 | |
| 156 | return envNameContainer.EnvironmentName |
| 157 | } |
| 158 | |
| 159 | func promptEnv(env *cliconfig.Environment, defaults cliconfig.Environment) error { |
| 160 | if env.OperatorEndpoint == "" { |
no test coverage detected