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

Function NewCmdCreate

pkg/cmd/channel/create/create.go:59–84  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

57}
58
59func NewCmdCreate(f factory.Factory) *cobra.Command {
60 createFlags := NewCreateFlags()
61 cmd := &cobra.Command{
62 Use: "create",
63 Short: "Create a channel",
64 Long: "Create a channel in Octopus Deploy",
65 Example: heredoc.Docf(`
66 %[1]s channel create
67 %[1]s channel create --name "The Channel" --project "The Project" --lifecycle "Default Lifecycle" --default
68 `, constants.ExecutableName),
69 RunE: func(c *cobra.Command, args []string) error {
70 opts := NewCreateOptions(createFlags, cmd.NewDependencies(f, c))
71
72 return createRun(opts)
73 },
74 }
75
76 flags := cmd.Flags()
77 flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "Name of the channel")
78 flags.StringVarP(&createFlags.Project.Value, createFlags.Project.Name, "p", "", "Project to create channel in")
79 flags.StringVarP(&createFlags.Description.Value, createFlags.Description.Name, "d", "", "Description of the channel")
80 flags.StringVarP(&createFlags.Lifecycle.Value, createFlags.Lifecycle.Name, "l", "", "The lifecycle to use for the channel")
81 flags.BoolVar(&createFlags.Default.Value, createFlags.Default.Name, false, "Set this channel as default")
82
83 return cmd
84}
85
86func createRun(opts *CreateOptions) error {
87 if !opts.NoPrompt {

Callers

nothing calls this directly

Calls 3

NewCreateFlagsFunction · 0.70
NewCreateOptionsFunction · 0.70
createRunFunction · 0.70

Tested by

no test coverage detected