(asker question.Asker, octopus *octopusApiClient.Client, deployableEnvironmentIDs []string, nextDeployEnvironmentID string)
| 1002 | } |
| 1003 | |
| 1004 | func selectDeploymentEnvironments(asker question.Asker, octopus *octopusApiClient.Client, deployableEnvironmentIDs []string, nextDeployEnvironmentID string) ([]*environments.Environment, error) { |
| 1005 | allEnvs, nextDeployEnvironmentName, err := loadEnvironmentsForDeploy(octopus, deployableEnvironmentIDs, nextDeployEnvironmentID) |
| 1006 | if err != nil { |
| 1007 | return nil, err |
| 1008 | } |
| 1009 | |
| 1010 | optionMap, options := question.MakeItemMapAndOptions(allEnvs, func(e *environments.Environment) string { return e.Name }) |
| 1011 | var selectedKeys []string |
| 1012 | err = asker(&survey.MultiSelect{ |
| 1013 | Message: "Select environment(s)", |
| 1014 | Options: options, |
| 1015 | Default: []string{nextDeployEnvironmentName}, |
| 1016 | }, &selectedKeys, survey.WithValidator(survey.Required)) |
| 1017 | |
| 1018 | if err != nil { |
| 1019 | return nil, err |
| 1020 | } |
| 1021 | var selectedValues []*environments.Environment |
| 1022 | for _, k := range selectedKeys { |
| 1023 | if value, ok := optionMap[k]; ok { |
| 1024 | selectedValues = append(selectedValues, value) |
| 1025 | } // if we were to somehow get invalid answers, ignore them |
| 1026 | } |
| 1027 | return selectedValues, nil |
| 1028 | } |
| 1029 | |
| 1030 | func PrintAdvancedSummary(stdout io.Writer, options *executor.TaskOptionsDeployRelease) { |
| 1031 | deployAtStr := "Now" |
no test coverage detected