(f factory.Factory)
| 34 | } |
| 35 | |
| 36 | func NewCmdCreate(f factory.Factory) *cobra.Command { |
| 37 | createFlags := NewCreateFlags() |
| 38 | |
| 39 | cmd := &cobra.Command{ |
| 40 | Use: "create", |
| 41 | Short: "Create a tenant", |
| 42 | Long: "Create a tenant in Octopus Deploy", |
| 43 | Example: heredoc.Docf("%s tenant create", constants.ExecutableName), |
| 44 | Aliases: []string{"new"}, |
| 45 | RunE: func(c *cobra.Command, _ []string) error { |
| 46 | opts := NewCreateOptions(createFlags, cmd.NewDependencies(f, c)) |
| 47 | |
| 48 | return createRun(opts) |
| 49 | }, |
| 50 | } |
| 51 | |
| 52 | flags := cmd.Flags() |
| 53 | flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "Name of the tenant") |
| 54 | flags.StringVarP(&createFlags.Description.Value, createFlags.Description.Name, "d", "", "Description of the tenant") |
| 55 | flags.StringArrayVarP(&createFlags.Tag.Value, createFlags.Tag.Name, "t", []string{}, "Tag to apply to tenant, must use canonical name: <tag_set>/<tag_name>") |
| 56 | |
| 57 | return cmd |
| 58 | } |
| 59 | |
| 60 | func createRun(opts *CreateOptions) error { |
| 61 | var optsArray []cmd.Dependable |
nothing calls this directly
no test coverage detected