@@ -66,21 +66,21 @@ func (r *RootCmd) switchOrganization() *clibase.Cmd {
66
66
return strings .Compare (a .Name , b .Name )
67
67
})
68
68
69
- var orgArg string
69
+ var switchToOrg string
70
70
if len (inv .Args ) == 0 {
71
- // Pull orgArg from a prompt selector, rather than command line
71
+ // Pull switchToOrg from a prompt selector, rather than command line
72
72
// args.
73
- orgArg , err = promptUserSelectOrg (inv , conf , orgs )
73
+ switchToOrg , err = promptUserSelectOrg (inv , conf , orgs )
74
74
if err != nil {
75
75
return err
76
76
}
77
77
} else {
78
- orgArg = inv .Args [0 ]
78
+ switchToOrg = inv .Args [0 ]
79
79
}
80
80
81
81
// If the user passes an empty string, we want to remove the organization
82
82
// from the config file. This will defer to default behavior.
83
- if orgArg == "" {
83
+ if switchToOrg == "" {
84
84
err := conf .Organization ().Delete ()
85
85
if err != nil && ! errors .Is (err , os .ErrNotExist ) {
86
86
return fmt .Errorf ("failed to unset organization: %w" , err )
@@ -89,13 +89,13 @@ func (r *RootCmd) switchOrganization() *clibase.Cmd {
89
89
} else {
90
90
// Find the selected org in our list.
91
91
index := slices .IndexFunc (orgs , func (org codersdk.Organization ) bool {
92
- return org .Name == orgArg || org .ID .String () == orgArg
92
+ return org .Name == switchToOrg || org .ID .String () == switchToOrg
93
93
})
94
94
if index < 0 {
95
95
// Using this error for better error message formatting
96
96
err := & codersdk.Error {
97
97
Response : codersdk.Response {
98
- Message : fmt .Sprintf ("Organization %q not found. Is the name correct, and are you a member of it?" , orgArg ),
98
+ Message : fmt .Sprintf ("Organization %q not found. Is the name correct, and are you a member of it?" , switchToOrg ),
99
99
Detail : "Ensure the organization argument is correct and you are a member of it." ,
100
100
},
101
101
Helper : fmt .Sprintf ("Valid organizations you can switch to: %q" , strings .Join (orgNames (orgs ), ", " )),
0 commit comments