MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / NewCmdCreate

Function NewCmdCreate

pkg/cmd/worker/ssh/create/create.go:62–86  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

60}
61
62func 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
88func createRun(opts *CreateOptions) error {
89 if !opts.NoPrompt {

Callers

nothing calls this directly

Calls 8

RegisterSshCommonFlagsFunction · 0.92
RegisterWebFlagFunction · 0.92
NewCreateFlagsFunction · 0.70
NewCreateOptionsFunction · 0.70
createRunFunction · 0.70

Tested by

no test coverage detected