| 609 | } |
| 610 | |
| 611 | func (c *cli) actionPickerOptions(ctx context.Context) (pickerOptions, error) { |
| 612 | list, err := c.api.Action.List(ctx) |
| 613 | if err != nil { |
| 614 | return nil, err |
| 615 | } |
| 616 | |
| 617 | var opts pickerOptions |
| 618 | for _, r := range list.Actions { |
| 619 | label := fmt.Sprintf("%s %s", r.GetName(), ansi.Faint("("+r.GetID()+")")) |
| 620 | |
| 621 | opts = append(opts, pickerOption{value: r.GetID(), label: label}) |
| 622 | } |
| 623 | |
| 624 | if len(opts) == 0 { |
| 625 | return nil, errors.New("there are currently no actions to choose from. Create one by running: `auth0 actions create`") |
| 626 | } |
| 627 | |
| 628 | return opts, nil |
| 629 | } |
| 630 | |
| 631 | func (c *cli) unDeployedActionPickerOptions(ctx context.Context) (pickerOptions, error) { |
| 632 | list, err := c.api.Action.List(ctx, management.Parameter("deployed", "false")) |