Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit887bcae

Browse files
committed
switch -> set
1 parent48947ec commit887bcae

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

‎cli/organization.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ func (r *RootCmd) switchOrganization() *clibase.Cmd {
3838
client:=new(codersdk.Client)
3939

4040
cmd:=&clibase.Cmd{
41-
Use:"switch <organization name | ID>",
42-
Short:"Switch the organization used by thecli. Pass an empty string to reset to the default organization.",
43-
Long:"Switch the organization used by thecli. Pass an empty string to reset to the default organization.\n"+formatExamples(
41+
Use:"set <organization name | ID>",
42+
Short:"set the organization used by theCLI. Pass an empty string to reset to the default organization.",
43+
Long:"set the organization used by theCLI. Pass an empty string to reset to the default organization.\n"+formatExamples(
4444
example{
4545
Description:"Remove the current organization and defer to the default.",
46-
Command:"coder organizationsswitch ''",
46+
Command:"coder organizationsset ''",
4747
},
4848
example{
4949
Description:"Switch to a custom organization.",
50-
Command:"coder organizationsswitch my-org",
50+
Command:"coder organizationsset my-org",
5151
},
5252
),
5353
Middleware:clibase.Chain(
@@ -118,7 +118,7 @@ func (r *RootCmd) switchOrganization() *clibase.Cmd {
118118
varsdkError*codersdk.Error
119119
iferrors.As(err,&sdkError) {
120120
ifsdkError.Helper==""&&sdkError.StatusCode()!=500 {
121-
sdkError.Helper=`If this error persists, try unsetting your org with 'coder organizationsswitch ""'`
121+
sdkError.Helper=`If this error persists, try unsetting your org with 'coder organizationsset ""'`
122122
}
123123
returnsdkError
124124
}
@@ -167,13 +167,15 @@ func promptUserSelectOrg(inv *clibase.Invocation, conf config.Root, orgs []coder
167167
defaultOrg=orgs[index].Name
168168
}
169169

170-
constdeselectOption="--Deselect--"
170+
// deselectOption is the option to delete the organization config file and defer
171+
// to default behavior.
172+
constdeselectOption="[Default]"
171173
ifdefaultOrg=="" {
172174
defaultOrg=deselectOption
173175
}
174176

175177
// Pull value from a prompt
176-
_,_=fmt.Fprintln(inv.Stdout,pretty.Sprint(cliui.DefaultStyles.Wrap,"Select an organization below toswitch the currentcli context to:"))
178+
_,_=fmt.Fprintln(inv.Stdout,pretty.Sprint(cliui.DefaultStyles.Wrap,"Select an organization below toset the currentCLI context to:"))
177179
value,err:=cliui.Select(inv, cliui.SelectOptions{
178180
Options:append([]string{deselectOption},orgNames(orgs)...),
179181
Default:defaultOrg,

‎cli/organization_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestOrganizationSwitch(t *testing.T) {
6666
exp,err:=client.OrganizationByName(ctx,codersdk.Me,"foo")
6767
require.NoError(t,err)
6868

69-
inv,root:=clitest.New(t,"organizations","switch","foo")
69+
inv,root:=clitest.New(t,"organizations","set","foo")
7070
clitest.SetupConfig(t,client,root)
7171
pty:=ptytest.New(t).Attach(inv)
7272
errC:=make(chanerror)

‎cli/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ func CurrentOrganization(r *RootCmd, inv *clibase.Invocation, client *codersdk.C
733733
returnorg.IsDefault
734734
})
735735
ifindex<0 {
736-
return codersdk.Organization{},xerrors.Errorf("unable to determine current organization. Use 'coderorganizations switch <org>' to select an organization to use")
736+
return codersdk.Organization{},xerrors.Errorf("unable to determine current organization. Use 'coderset <org>' to select an organization to use")
737737
}
738738

739739
returnorgs[index],nil

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp