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

Function deleteAppCmd

internal/cli/apps.go:385–437  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

383}
384
385func deleteAppCmd(cli *cli) *cobra.Command {
386 cmd := &cobra.Command{
387 Use: "delete",
388 Aliases: []string{"rm"},
389 Short: "Delete an application",
390 Long: "Delete an application.\n\n" +
391 "To delete interactively, use `auth0 apps delete` with no arguments.\n\n" +
392 "To delete non-interactively, supply the application id and the `--force` " +
393 "flag to skip confirmation.",
394 Example: ` auth0 apps delete
395 auth0 apps rm
396 auth0 apps delete <app-id>
397 auth0 apps delete <app-id> --force
398 auth0 apps delete <app-id> <app-id2> <app-idn>
399 auth0 apps delete <app-id> <app-id2> <app-idn> --force`,
400 RunE: func(cmd *cobra.Command, args []string) error {
401 var ids []string
402 if len(args) == 0 {
403 if err := appID.PickMany(cmd, &ids, cli.appPickerOptions()); err != nil {
404 return err
405 }
406 } else {
407 ids = args
408 }
409
410 if !cli.force && canPrompt(cmd) {
411 if tenant, _ := cli.Config.GetTenant(cli.tenant); slices.Contains(ids, tenant.ClientID) {
412 cli.renderer.Warnf("Warning: You're about to delete the client used to authenticate the CLI. If deleted, the CLI will cease to operate once the access token has expired.")
413 }
414 if confirmed := prompt.Confirm("Are you sure you want to proceed?"); !confirmed {
415 return nil
416 }
417 }
418
419 return ansi.ProgressBar("Deleting Application(s)", ids, func(_ int, id string) error {
420 if id != "" {
421 if _, err := cli.api.Client.Read(cmd.Context(), id); err != nil {
422 return fmt.Errorf("failed to delete application with ID %q: %w", id, err)
423 }
424
425 if err := cli.api.Client.Delete(cmd.Context(), id); err != nil {
426 return fmt.Errorf("failed to delete application with ID %q: %w", id, err)
427 }
428 }
429 return nil
430 })
431 },
432 }
433
434 cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")
435
436 return cmd
437}
438
439func createAppCmd(cli *cli) *cobra.Command {
440 var inputs struct {

Callers 1

appsCmdFunction · 0.85

Calls 10

ConfirmFunction · 0.92
ProgressBarFunction · 0.92
canPromptFunction · 0.85
appPickerOptionsMethod · 0.80
GetTenantMethod · 0.80
WarnfMethod · 0.80
ErrorfMethod · 0.80
ReadMethod · 0.65
DeleteMethod · 0.65
PickManyMethod · 0.45

Tested by

no test coverage detected