| 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)) |
| 832 | if err != nil { |
| 833 | return nil, err |
| 834 | } |
| 835 | |
| 836 | var opts pickerOptions |
| 837 | for _, inv := range orgInvitations.OrganizationInvitations { |
| 838 | id := inv.GetID() |
| 839 | label := fmt.Sprintf("%s %s", inv.Invitee.GetEmail(), ansi.Faint("("+id+")")) |
| 840 | opts = append(opts, pickerOption{value: id, label: label}) |
| 841 | } |
| 842 | |
| 843 | if len(opts) == 0 { |
| 844 | return nil, errors.New("there are currently no invitations to choose from") |
| 845 | } |
| 846 | |
| 847 | return opts, nil |
| 848 | } |
| 849 | |
| 850 | func formatOrganizationDetailsPath(id string) string { |
| 851 | if len(id) == 0 { |