(opts *CreateOptions)
| 131 | } |
| 132 | |
| 133 | func PromptMissing(opts *CreateOptions) error { |
| 134 | err := question.AskName(opts.Ask, "", "channel", &opts.Name.Value) |
| 135 | if err != nil { |
| 136 | return err |
| 137 | } |
| 138 | |
| 139 | var selectedProject *projects.Project |
| 140 | if opts.Project.Value == "" { |
| 141 | selectedProject, err = selectors.Project("Select the project in which the channel will be created", opts.Client, opts.Ask) |
| 142 | if err != nil { |
| 143 | return err |
| 144 | } |
| 145 | } else { |
| 146 | selectedProject, err = selectors.FindProject(opts.Client, opts.Project.Value) |
| 147 | if err != nil { |
| 148 | return err |
| 149 | } |
| 150 | } |
| 151 | opts.Project.Value = selectedProject.Name |
| 152 | |
| 153 | err = question.AskDescription(opts.Ask, "", "channel", &opts.Description.Value) |
| 154 | if err != nil { |
| 155 | return err |
| 156 | } |
| 157 | |
| 158 | var selectedLifecycle *lifecycles.Lifecycle |
| 159 | if opts.Lifecycle.Value == "" { |
| 160 | var shouldInheritLifecycleFromProject string |
| 161 | err := opts.Ask(&survey.Select{ |
| 162 | Message: "Inherit lifecycle from project?", |
| 163 | Help: "Select 'No' to select lifecycle to use for channel", |
| 164 | Options: []string{"Yes", "No"}, |
| 165 | }, &shouldInheritLifecycleFromProject) |
| 166 | if err != nil { |
| 167 | return err |
| 168 | } |
| 169 | if shouldInheritLifecycleFromProject == "No" { |
| 170 | selectedLifecycle, err = selectors.Lifecycle("Select the lifecycle to use for the channel", opts.Client, opts.Ask) |
| 171 | if err != nil { |
| 172 | return err |
| 173 | } |
| 174 | } |
| 175 | } else { |
| 176 | selectedLifecycle, err = selectors.FindLifecycle(opts.Client, opts.Lifecycle.Value) |
| 177 | if err != nil { |
| 178 | return nil |
| 179 | } |
| 180 | } |
| 181 | if selectedLifecycle != nil { |
| 182 | opts.Lifecycle.Value = selectedLifecycle.Name |
| 183 | } |
| 184 | |
| 185 | _, err = promptBool(opts, &opts.Default.Value, false, "Set channel as default", "If default is enabled, this will set this channel as the default channel for the project") |
| 186 | if err != nil { |
| 187 | return err |
| 188 | } |
| 189 | |
| 190 | return nil |
no test coverage detected