(f factory.Factory)
| 46 | } |
| 47 | |
| 48 | func NewCmdCreate(f factory.Factory) *cobra.Command { |
| 49 | createFlags := NewCreateFlags() |
| 50 | |
| 51 | cmd := &cobra.Command{ |
| 52 | Use: "create", |
| 53 | Short: "Create a static worker pool", |
| 54 | Long: "Create a static worker pool in Octopus Deploy", |
| 55 | Example: heredoc.Docf(` |
| 56 | %s worker-pool static create |
| 57 | `, constants.ExecutableName), |
| 58 | RunE: func(c *cobra.Command, _ []string) error { |
| 59 | opts := NewCreateOptions(createFlags, cmd.NewDependencies(f, c)) |
| 60 | |
| 61 | return createRun(opts) |
| 62 | }, |
| 63 | } |
| 64 | |
| 65 | flags := cmd.Flags() |
| 66 | flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "A short, memorable, unique name for this worker pool.") |
| 67 | flags.StringVar(&createFlags.Description.Value, createFlags.Description.Name, "", "Description of the worker pool.") |
| 68 | |
| 69 | machinescommon.RegisterWebFlag(cmd, createFlags.WebFlags) |
| 70 | |
| 71 | return cmd |
| 72 | } |
| 73 | |
| 74 | func createRun(opts *CreateOptions) error { |
| 75 | if !opts.NoPrompt { |
nothing calls this directly
no test coverage detected