promptEnvironments Prompts the user for the environments to apply against and returns a slice of strings representing the environments
()
| 166 | |
| 167 | // promptEnvironments Prompts the user for the environments to apply against and returns a slice of strings representing the environments |
| 168 | func promptEnvironments() []string { |
| 169 | items := map[string][]string{ |
| 170 | "Staging": {"stage"}, |
| 171 | "Production": {"prod"}, |
| 172 | } |
| 173 | |
| 174 | labels := []string{"Staging", "Production"} |
| 175 | |
| 176 | providerPrompt := promptui.Select{ |
| 177 | Label: "Environments", |
| 178 | Items: labels, |
| 179 | } |
| 180 | _, providerResult, err := providerPrompt.Run() |
| 181 | if err != nil { |
| 182 | log.Fatalf("Prompt failed %v\n", err) |
| 183 | panic(err) |
| 184 | } |
| 185 | return items[providerResult] |
| 186 | } |
| 187 | |
| 188 | func validateEnvironments(applyEnvironments []string) { |
| 189 | // Strict for now, we can brainstorm how much we want to support custom environments later |