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

Function createRun

pkg/cmd/project/create/create.go:83–124  ·  view source on GitHub ↗
(opts *CreateOptions)

Source from the content-addressed store, hash-verified

81}
82
83func createRun(opts *CreateOptions) error {
84 var optsArray []cmd.Dependable
85 var err error
86 if !opts.NoPrompt {
87 optsArray, err = PromptMissing(opts)
88 if err != nil {
89 return err
90 }
91 } else {
92 // Validate tags when running with --no-prompt
93 if len(opts.Tag.Value) > 0 {
94 tagSets, err := opts.GetAllTagsCallback()
95 if err != nil {
96 return err
97 }
98 if err := selectors.ValidateTags(opts.Tag.Value, tagSets); err != nil {
99 return err
100 }
101 }
102
103 optsArray = append(optsArray, opts)
104 if opts.ConfigAsCode.Value {
105 opts.ConvertOptions.Project.Value = opts.Name.Value
106 optsArray = append(optsArray, opts.ConvertOptions)
107 }
108 }
109
110 for _, o := range optsArray {
111 if err := o.Commit(); err != nil {
112 return err
113 }
114 }
115
116 if !opts.NoPrompt {
117 fmt.Fprintln(opts.Out, "\nAutomation Commands:")
118 for _, o := range optsArray {
119 o.GenerateAutomationCmd()
120 }
121 }
122
123 return nil
124}
125
126func PromptMissing(opts *CreateOptions) ([]cmd.Dependable, error) {
127 nestedOpts := []cmd.Dependable{}

Callers 1

NewCmdCreateFunction · 0.70

Calls 4

ValidateTagsFunction · 0.92
PromptMissingFunction · 0.70
CommitMethod · 0.65
GenerateAutomationCmdMethod · 0.65

Tested by

no test coverage detected