MCPcopy Index your code
hub / github.com/rilldata/rill / SwitchSelectFlow

Function SwitchSelectFlow

cli/cmd/org/switch.go:64–81  ·  view source on GitHub ↗
(ch *cmdutil.Helper, orgs []*adminv1.Organization)

Source from the content-addressed store, hash-verified

62}
63
64func 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.
84func SetDefaultOrg(ctx context.Context, ch *cmdutil.Helper) error {

Callers 2

SwitchCmdFunction · 0.85
SetDefaultOrgFunction · 0.85

Calls 3

SelectPromptFunction · 0.92
PrintlnMethod · 0.80
GetDefaultOrgMethod · 0.80

Tested by

no test coverage detected