MCPcopy Create free account
hub / github.com/algolia/cli / resolveName

Function resolveName

pkg/cmd/application/create/create.go:338–357  ·  view source on GitHub ↗

resolveName returns the application name, prompting when interactive and --name is unset.

(opts *CreateOptions)

Source from the content-addressed store, hash-verified

336
337// resolveName returns the application name, prompting when interactive and --name is unset.
338func 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.
360func selectPlan(

Callers 3

TestResolveNameFunction · 0.85
printDryRunSummaryFunction · 0.85
createApplicationFunction · 0.85

Calls 1

CanPromptMethod · 0.80

Tested by 1

TestResolveNameFunction · 0.68