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

Function NewCmdCreate

pkg/cmd/environment/create/create.go:63–87  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

61}
62
63func NewCmdCreate(f factory.Factory) *cobra.Command {
64 createFlags := NewCreateFlags()
65
66 cmd := &cobra.Command{
67 Use: "create",
68 Short: "Create an environment",
69 Long: "Create a environment in Octopus Deploy",
70 Example: heredoc.Docf("%s environment create", constants.ExecutableName),
71 Aliases: []string{"new"},
72 RunE: func(c *cobra.Command, _ []string) error {
73 opts := NewCreateOptions(createFlags, cmd.NewDependencies(f, c))
74
75 return createRun(opts)
76 },
77 }
78
79 flags := cmd.Flags()
80 flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "Name of the environment")
81 flags.StringVarP(&createFlags.Description.Value, createFlags.Description.Name, "d", "", "Description of the environment")
82 flags.BoolVar(&createFlags.GuidedFailureMode.Value, createFlags.GuidedFailureMode.Name, false, "Use guided failure mode by default")
83 flags.BoolVar(&createFlags.DynamicInfrastructure.Value, createFlags.DynamicInfrastructure.Name, false, "Allow dynamic infrastructure")
84 flags.StringArrayVarP(&createFlags.Tag.Value, createFlags.Tag.Name, "t", []string{}, "Tag to apply to environment, must use canonical name: <tag_set>/<tag_name>")
85
86 return cmd
87}
88
89func createRun(opts *CreateOptions) error {
90 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