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

Function deleteActionCmd

internal/cli/actions.go:398–442  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

396}
397
398func 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
444func deployActionCmd(cli *cli) *cobra.Command {
445 var inputs struct {

Callers 1

actionsCmdFunction · 0.85

Calls 6

ConfirmFunction · 0.92
ProgressBarFunction · 0.92
canPromptFunction · 0.85
ErrorfMethod · 0.80
DeleteMethod · 0.65
PickManyMethod · 0.45

Tested by

no test coverage detected