(cli *cli)
| 396 | } |
| 397 | |
| 398 | func deleteActionCmd(cli *cli) *cobra.Command { |
| 399 | cmd := &cobra.Command{ |
| 400 | Use: "delete", |
| 401 | Aliases: []string{"rm"}, |
| 402 | Short: "Delete an action", |
| 403 | Long: "Delete an action.\n\n" + |
| 404 | "To delete interactively, use `auth0 actions delete` with no arguments.\n\n" + |
| 405 | "To delete non-interactively, supply the action id and the `--force` flag to skip confirmation.", |
| 406 | Example: ` auth0 actions delete |
| 407 | auth0 actions rm |
| 408 | auth0 actions delete <action-id> |
| 409 | auth0 actions delete <action-id> --force |
| 410 | auth0 actions delete <action-id> <action-id2> <action-idn> |
| 411 | auth0 actions delete <action-id> <action-id2> <action-idn> --force`, |
| 412 | RunE: func(cmd *cobra.Command, args []string) error { |
| 413 | var ids []string |
| 414 | if len(args) == 0 { |
| 415 | if err := actionID.PickMany(cmd, &ids, cli.actionPickerOptions); err != nil { |
| 416 | return err |
| 417 | } |
| 418 | } else { |
| 419 | ids = args |
| 420 | } |
| 421 | |
| 422 | if !cli.force && canPrompt(cmd) { |
| 423 | if confirmed := prompt.Confirm("Are you sure you want to proceed?"); !confirmed { |
| 424 | return nil |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | return ansi.ProgressBar("Deleting action(s)", ids, func(i int, id string) error { |
| 429 | if id != "" { |
| 430 | if err := cli.api.Action.Delete(cmd.Context(), id); err != nil { |
| 431 | return fmt.Errorf("failed to delete Action with ID %q: %w", id, err) |
| 432 | } |
| 433 | } |
| 434 | return nil |
| 435 | }) |
| 436 | }, |
| 437 | } |
| 438 | |
| 439 | cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.") |
| 440 | |
| 441 | return cmd |
| 442 | } |
| 443 | |
| 444 | func deployActionCmd(cli *cli) *cobra.Command { |
| 445 | var inputs struct { |
no test coverage detected