(f factory.Factory)
| 69 | } |
| 70 | |
| 71 | func NewCmdCreate(f factory.Factory) *cobra.Command { |
| 72 | optFlags := NewCreateFlags() |
| 73 | cmd := &cobra.Command{ |
| 74 | Use: "create", |
| 75 | Short: "Create a project group", |
| 76 | Long: "Create a project group in Octopus Deploy", |
| 77 | Example: heredoc.Docf("%s project-group create", constants.ExecutableName), |
| 78 | Aliases: []string{"new"}, |
| 79 | RunE: func(c *cobra.Command, _ []string) error { |
| 80 | opts := NewCreateOptions(optFlags, cmd.NewDependencies(f, c)) |
| 81 | |
| 82 | return createRun(opts) |
| 83 | }, |
| 84 | } |
| 85 | |
| 86 | flags := cmd.Flags() |
| 87 | flags.StringVarP(&optFlags.Name.Value, optFlags.Name.Name, "n", "", "Name of the project group") |
| 88 | flags.StringVarP(&optFlags.Description.Value, optFlags.Description.Name, "d", "", "Description of the project group") |
| 89 | flags.SortFlags = false |
| 90 | |
| 91 | return cmd |
| 92 | } |
| 93 | |
| 94 | func createRun(opts *CreateOptions) error { |
| 95 | if !opts.NoPrompt { |
nothing calls this directly
no test coverage detected