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

Function useTenantCmd

internal/cli/tenants.go:65–90  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

63}
64
65func useTenantCmd(cli *cli) *cobra.Command {
66 cmd := &cobra.Command{
67 Use: "use",
68 Args: cobra.MaximumNArgs(1),
69 Short: "Set the active tenant",
70 Long: "Set the active tenant for the Auth0 CLI.",
71 Example: ` auth0 tenants use
72 auth0 tenants use <tenant>
73 auth0 tenants use "example.us.auth0.com"`,
74 RunE: func(cmd *cobra.Command, args []string) error {
75 selectedTenant, err := selectValidTenantFromConfig(cli, cmd, args)
76 if err != nil {
77 return err
78 }
79
80 if err := cli.Config.SetDefaultTenant(selectedTenant); err != nil {
81 return fmt.Errorf("failed to set the default tenant: %w", err)
82 }
83
84 cli.renderer.Infof("Default tenant switched to: %s", selectedTenant)
85 return nil
86 },
87 }
88
89 return cmd
90}
91
92func openTenantCmd(cli *cli) *cobra.Command {
93 cmd := &cobra.Command{

Callers 1

tenantsCmdFunction · 0.85

Calls 4

SetDefaultTenantMethod · 0.80
ErrorfMethod · 0.80
InfofMethod · 0.80

Tested by

no test coverage detected