| 531 | } |
| 532 | |
| 533 | func setupQuickstartCmd(cli *cli) *cobra.Command { |
| 534 | var inputs SetupInputs |
| 535 | |
| 536 | cmd := &cobra.Command{ |
| 537 | Use: "setup", |
| 538 | Args: cobra.NoArgs, |
| 539 | Short: "Set up Auth0 for your quickstart application", |
| 540 | Long: `Auto-detects your project, creates an Auth0 application and/or API, and generates a config file. |
| 541 | |
| 542 | Workflows: |
| 543 | --app Create an application (auto-detects framework). |
| 544 | --api Create an API (prompts to create or link an app). |
| 545 | --api --linked-app-id <id> Create an API linked to an existing application.`, |
| 546 | Example: ` # Interactive setup: |
| 547 | auth0 quickstarts setup |
| 548 | |
| 549 | # App only: |
| 550 | auth0 quickstarts setup --app --type spa --framework react |
| 551 | |
| 552 | # App with all options: |
| 553 | auth0 quickstarts setup --app --type spa --framework react --build-tool vite --name "My SPA" --port 5173 |
| 554 | |
| 555 | # API + new app: |
| 556 | auth0 quickstarts setup --api --app --type regular --framework express --identifier https://my-api |
| 557 | |
| 558 | # API + existing app: |
| 559 | auth0 quickstarts setup --api --linked-app-id <client-id> --identifier https://my-api |
| 560 | |
| 561 | # API with custom settings: |
| 562 | auth0 quickstarts setup --api --linked-app-id <client-id> --identifier https://my-api --scopes "read:data,write:data"`, |
| 563 | RunE: func(cmd *cobra.Command, args []string) error { |
| 564 | return runSetupQuickstart(cmd, cli, &inputs) |
| 565 | }, |
| 566 | } |
| 567 | |
| 568 | // App flags. |
| 569 | registerSetupFlags(cmd, &inputs) |
| 570 | |
| 571 | cmd.MarkFlagsMutuallyExclusive("app", "linked-app-id") |
| 572 | |
| 573 | return cmd |
| 574 | } |
| 575 | |
| 576 | // registerSetupFlags registers all flags for the setup command. |
| 577 | func registerSetupFlags(cmd *cobra.Command, inputs *SetupInputs) { |