(f factory.Factory)
| 50 | } |
| 51 | |
| 52 | func NewCmdAllow(f factory.Factory) *cobra.Command { |
| 53 | allowFlags := NewAllowFlags() |
| 54 | |
| 55 | cmd := &cobra.Command{ |
| 56 | Use: "allow", |
| 57 | Short: "Allows a release to progress to the next phase.", |
| 58 | Long: "Allows a release to progress to the next phase in Octopus Deploy.", |
| 59 | Example: heredoc.Docf(` |
| 60 | %[1]s release progression allow --project MyProject --version 1.2.3 |
| 61 | %[1]s release progression allow -p MyProject -v 1.2.3 |
| 62 | %[1]s release progression allow -p MyProject -v 1.2.3 --no-prompt |
| 63 | `, constants.ExecutableName), |
| 64 | Aliases: []string{"allow-releaseprogression"}, |
| 65 | RunE: func(c *cobra.Command, _ []string) error { |
| 66 | opts := NewAllowOptions(allowFlags, cmd.NewDependencies(f, c)) |
| 67 | return resolveReleaseDefectRun(opts) |
| 68 | }, |
| 69 | } |
| 70 | |
| 71 | flags := cmd.Flags() |
| 72 | flags.StringVarP(&allowFlags.Project.Value, allowFlags.Project.Name, "p", "", "Name or ID of the project.") |
| 73 | flags.StringVarP(&allowFlags.Version.Value, allowFlags.Version.Name, "v", "", "Release version/number.") |
| 74 | |
| 75 | flags.SortFlags = false |
| 76 | |
| 77 | flagAliases := make(map[string][]string, 1) |
| 78 | util.AddFlagAliasesString(flags, FlagVersion, flagAliases, FlagAliasReleaseNumberLegacy) |
| 79 | |
| 80 | cmd.PreRunE = func(cmd *cobra.Command, args []string) error { |
| 81 | util.ApplyFlagAliases(cmd.Flags(), flagAliases) |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | return cmd |
| 86 | } |
| 87 | |
| 88 | func resolveReleaseDefectRun(opts *AllowOptions) error { |
| 89 | if !opts.NoPrompt { |
nothing calls this directly
no test coverage detected