(f factory.Factory)
| 60 | } |
| 61 | |
| 62 | func NewCmdCreate(f factory.Factory) *cobra.Command { |
| 63 | createFlags := NewCreateFlags() |
| 64 | |
| 65 | cmd := &cobra.Command{ |
| 66 | Use: "create", |
| 67 | Short: "Create a SSH worker", |
| 68 | Long: "Create a SSH worker in Octopus Deploy", |
| 69 | Example: heredoc.Docf("%s worker ssh create", constants.ExecutableName), |
| 70 | RunE: func(c *cobra.Command, _ []string) error { |
| 71 | opts := NewCreateOptions(createFlags, cmd.NewDependencies(f, c)) |
| 72 | |
| 73 | return createRun(opts) |
| 74 | }, |
| 75 | } |
| 76 | |
| 77 | flags := cmd.Flags() |
| 78 | flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "A short, memorable, unique name for this worker.") |
| 79 | machinescommon.RegisterSshCommonFlags(cmd, createFlags.SshCommonFlags, "worker") |
| 80 | machinescommon.RegisterCreateTargetProxyFlags(cmd, createFlags.CreateTargetProxyFlags, "SSH worker") |
| 81 | machinescommon.RegisterCreateTargetMachinePolicyFlags(cmd, createFlags.CreateTargetMachinePolicyFlags) |
| 82 | shared.RegisterCreateWorkerWorkerPoolFlags(cmd, createFlags.WorkerPoolFlags) |
| 83 | machinescommon.RegisterWebFlag(cmd, createFlags.WebFlags) |
| 84 | |
| 85 | return cmd |
| 86 | } |
| 87 | |
| 88 | func createRun(opts *CreateOptions) error { |
| 89 | if !opts.NoPrompt { |
nothing calls this directly
no test coverage detected