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

Function NewCmdCreate

pkg/cmd/space/create/create.go:75–97  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

73}
74
75func NewCmdCreate(f factory.Factory) *cobra.Command {
76 createFlags := NewCreateFlags()
77 cmd := &cobra.Command{
78 Use: "create",
79 Short: "Create a space",
80 Long: "Create a space in Octopus Deploy",
81 Example: heredoc.Docf("%s space create", constants.ExecutableName),
82 Aliases: []string{"new"},
83 RunE: func(c *cobra.Command, args []string) error {
84 opts := NewCreateOptions(f, createFlags, c)
85
86 return createRun(opts)
87 },
88 }
89
90 flags := cmd.Flags()
91 flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "Name of the space")
92 flags.StringVarP(&createFlags.Description.Value, createFlags.Description.Name, "d", "", "Description of the space")
93 flags.StringArrayVarP(&createFlags.Teams.Value, createFlags.Teams.Name, "t", nil, "The teams to manage the space (can be specified multiple times)")
94 flags.StringArrayVarP(&createFlags.Users.Value, createFlags.Users.Name, "u", nil, "The users to manage the space (can be specified multiple times)")
95
96 return cmd
97}
98
99func createRun(opts *CreateOptions) error {
100 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