(f factory.Factory)
| 73 | } |
| 74 | |
| 75 | func NewCmdCreate(f factory.Factory) *cobra.Command { |
| 76 | createFlags := NewCreateFlags() |
| 77 | cmd := &cobra.Command{ |
| 78 | Use: "create", |
| 79 | Short: "Create a space", |
| 80 | Long: "Create a space in Octopus Deploy", |
| 81 | Example: heredoc.Docf("%s space create", constants.ExecutableName), |
| 82 | Aliases: []string{"new"}, |
| 83 | RunE: func(c *cobra.Command, args []string) error { |
| 84 | opts := NewCreateOptions(f, createFlags, c) |
| 85 | |
| 86 | return createRun(opts) |
| 87 | }, |
| 88 | } |
| 89 | |
| 90 | flags := cmd.Flags() |
| 91 | flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "Name of the space") |
| 92 | flags.StringVarP(&createFlags.Description.Value, createFlags.Description.Name, "d", "", "Description of the space") |
| 93 | flags.StringArrayVarP(&createFlags.Teams.Value, createFlags.Teams.Name, "t", nil, "The teams to manage the space (can be specified multiple times)") |
| 94 | flags.StringArrayVarP(&createFlags.Users.Value, createFlags.Users.Name, "u", nil, "The users to manage the space (can be specified multiple times)") |
| 95 | |
| 96 | return cmd |
| 97 | } |
| 98 | |
| 99 | func createRun(opts *CreateOptions) error { |
| 100 | if !opts.NoPrompt { |
nothing calls this directly
no test coverage detected