(ch *cmdutil.Helper, orgs []*adminv1.Organization)
| 62 | } |
| 63 | |
| 64 | func SwitchSelectFlow(ch *cmdutil.Helper, orgs []*adminv1.Organization) (string, error) { |
| 65 | if len(orgs) < 1 { |
| 66 | fmt.Println("No organizations found, run `rill org create` first.") |
| 67 | return "", nil |
| 68 | } |
| 69 | |
| 70 | var orgNames []string |
| 71 | for _, org := range orgs { |
| 72 | orgNames = append(orgNames, org.Name) |
| 73 | } |
| 74 | |
| 75 | org, err := ch.DotRill.GetDefaultOrg() |
| 76 | if err != nil { |
| 77 | return "", err |
| 78 | } |
| 79 | |
| 80 | return cmdutil.SelectPrompt("Select default org.", orgNames, org) |
| 81 | } |
| 82 | |
| 83 | // SetDefaultOrg sets a default org for the user if user is part of any org. |
| 84 | func SetDefaultOrg(ctx context.Context, ch *cmdutil.Helper) error { |
no test coverage detected