(cli *cli)
| 220 | } |
| 221 | |
| 222 | func useAppCmd(cli *cli) *cobra.Command { |
| 223 | var inputs struct { |
| 224 | ID string |
| 225 | None bool |
| 226 | } |
| 227 | |
| 228 | cmd := &cobra.Command{ |
| 229 | Use: "use", |
| 230 | Args: cobra.MaximumNArgs(1), |
| 231 | Short: "Choose a default application for the Auth0 CLI", |
| 232 | Long: "Specify the default application used when running other commands. Specifically when downloading " + |
| 233 | "quickstarts and testing Universal login flow.", |
| 234 | Example: ` auth0 apps use |
| 235 | auth0 apps use --none |
| 236 | auth0 apps use <app-id>`, |
| 237 | RunE: func(cmd *cobra.Command, args []string) error { |
| 238 | if inputs.None { |
| 239 | inputs.ID = "" |
| 240 | } else { |
| 241 | if len(args) == 0 { |
| 242 | if err := appID.Pick(cmd, &inputs.ID, cli.appPickerOptions()); err != nil { |
| 243 | return err |
| 244 | } |
| 245 | } else { |
| 246 | inputs.ID = args[0] |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | if err := cli.Config.SetDefaultAppIDForTenant(cli.tenant, inputs.ID); err != nil { |
| 251 | return err |
| 252 | } |
| 253 | |
| 254 | if inputs.ID == "" { |
| 255 | cli.renderer.Infof("Successfully removed the default application") |
| 256 | } else { |
| 257 | cli.renderer.Infof("Successfully set the default application to %s", ansi.Faint(inputs.ID)) |
| 258 | cli.renderer.Infof("%s Consider running `auth0 quickstarts download %s`", ansi.Faint("Hint:"), inputs.ID) |
| 259 | } |
| 260 | |
| 261 | return nil |
| 262 | }, |
| 263 | } |
| 264 | |
| 265 | appNone.RegisterBool(cmd, &inputs.None, false) |
| 266 | |
| 267 | return cmd |
| 268 | } |
| 269 | |
| 270 | func listAppsCmd(cli *cli) *cobra.Command { |
| 271 | var inputs struct { |
no test coverage detected