resolveName returns the application name, prompting when interactive and --name is unset.
(opts *CreateOptions)
| 336 | |
| 337 | // resolveName returns the application name, prompting when interactive and --name is unset. |
| 338 | func resolveName(opts *CreateOptions) (string, error) { |
| 339 | if opts.nameProvided || !opts.IO.CanPrompt() { |
| 340 | return opts.Name, nil |
| 341 | } |
| 342 | |
| 343 | var name string |
| 344 | if err := prompt.SurveyAskOne( |
| 345 | &survey.Input{ |
| 346 | Message: "Name:", |
| 347 | Default: opts.Name, |
| 348 | }, |
| 349 | &name, |
| 350 | ); err != nil { |
| 351 | return "", err |
| 352 | } |
| 353 | if name == "" { |
| 354 | name = opts.Name |
| 355 | } |
| 356 | return name, nil |
| 357 | } |
| 358 | |
| 359 | // selectPlan resolves the target plan from --plan or an interactive picker. |
| 360 | func selectPlan( |