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

Function PromptMissing

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

Source from the content-addressed store, hash-verified

124}
125
126func PromptMissing(opts *CreateOptions) ([]cmd.Dependable, error) {
127 nestedOpts := []cmd.Dependable{}
128
129 question.AskName(opts.Ask, "", "project", &opts.Name.Value)
130
131 if opts.Lifecycle.Value == "" {
132 lc, err := selectors.Lifecycle("You have not specified a Lifecycle for this project. Please select one:", opts.Client, opts.Ask)
133 if err != nil {
134 return nil, err
135 }
136 opts.Lifecycle.Value = lc.Name
137 }
138
139 value, projectGroupOpt, err := projectShared.AskProjectGroups(opts.Ask, opts.Group.Value, opts.GetAllGroupsCallback, opts.CreateProjectGroupCallback)
140 if err != nil {
141 return nil, err
142 }
143 opts.Group.Value = value
144 if projectGroupOpt != nil {
145 nestedOpts = append(nestedOpts, projectGroupOpt)
146 }
147
148 nestedOpts = append(nestedOpts, opts)
149
150 tagSets, err := opts.GetAllTagsCallback()
151 if err != nil {
152 return nil, err
153 }
154
155 tags, err := selectors.Tags(opts.Ask, []string{}, opts.Tag.Value, tagSets)
156 if err != nil {
157 return nil, err
158 }
159 opts.Tag.Value = tags
160
161 configAsCodeOpts, err := PromptForConfigAsCode(opts)
162 opts.ConvertOptions.Project.Value = opts.Name.Value
163 if err != nil {
164 return nil, err
165 }
166 if configAsCodeOpts != nil {
167 nestedOpts = append(nestedOpts, configAsCodeOpts)
168 }
169
170 return nestedOpts, nil
171}
172
173func PromptForConfigAsCode(opts *CreateOptions) (cmd.Dependable, error) {
174 if !opts.ConfigAsCode.Value {

Callers 1

createRunFunction · 0.70

Calls 4

AskNameFunction · 0.92
LifecycleFunction · 0.92
TagsFunction · 0.92
PromptForConfigAsCodeFunction · 0.70

Tested by

no test coverage detected