| 808 | } |
| 809 | |
| 810 | func (c *cli) organizationPickerOptions(ctx context.Context) (pickerOptions, error) { |
| 811 | list, err := c.api.Organization.List(ctx) |
| 812 | if err != nil { |
| 813 | return nil, err |
| 814 | } |
| 815 | |
| 816 | var opts pickerOptions |
| 817 | for _, r := range list.Organizations { |
| 818 | label := fmt.Sprintf("%s %s", r.GetName(), ansi.Faint("("+r.GetID()+")")) |
| 819 | |
| 820 | opts = append(opts, pickerOption{value: r.GetID(), label: label}) |
| 821 | } |
| 822 | |
| 823 | if len(opts) == 0 { |
| 824 | return nil, errors.New("there are currently no organizations to choose from. Create one by running: `auth0 orgs create`") |
| 825 | } |
| 826 | |
| 827 | return opts, nil |
| 828 | } |
| 829 | |
| 830 | func (c *cli) invitationPickerOptions(ctx context.Context, orgID string) (pickerOptions, error) { |
| 831 | orgInvitations, err := c.api.Organization.Invitations(ctx, url.PathEscape(orgID)) |