MCPcopy Create free account
hub / github.com/auth0/auth0-cli / resolveSetupTargets

Function resolveSetupTargets

internal/cli/quickstarts.go:686–721  ·  view source on GitHub ↗

resolveSetupTargets resolves the App/API selection, prompting when allowed.

(inputs *SetupInputs, canPromptFlag bool)

Source from the content-addressed store, hash-verified

684
685// resolveSetupTargets resolves the App/API selection, prompting when allowed.
686func resolveSetupTargets(inputs *SetupInputs, canPromptFlag bool) error {
687 if inputs.App || inputs.API {
688 return nil
689 }
690 if !canPromptFlag {
691 return fmt.Errorf("in --no-input mode, specify at least one of --app or --api")
692 }
693
694 const (
695 optApp = "App Only"
696 optAPI = "API (Associate with an App)"
697 )
698
699 var selection string
700 q := prompt.SelectInput(
701 "setup-target",
702 "What do you want to create?",
703 "Select App to create an application, or API to create an API linked to an app.",
704 []string{optApp, optAPI},
705 optApp,
706 true,
707 )
708 if err := prompt.AskOne(q, &selection); err != nil {
709 return fmt.Errorf("failed to select target resource: %w", err)
710 }
711
712 switch selection {
713 case optApp:
714 inputs.App = true
715 case optAPI:
716 inputs.API = true
717 default:
718 return fmt.Errorf("unexpected selection: %q", selection)
719 }
720 return nil
721}
722
723// resolveAPIAppLink handles the API flow's app-linking decision.
724// It either sets inputs.LinkedAppID (via picker or flag) or flips inputs.App=true

Callers 1

runSetupQuickstartFunction · 0.85

Calls 3

SelectInputFunction · 0.92
AskOneFunction · 0.92
ErrorfMethod · 0.80

Tested by

no test coverage detected