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
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commit56b570a

Browse files
committed
Fixes
1 parent36ececb commit56b570a

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

‎internal/cmd/ceapi.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ func lookupUserOrgs(user *coder.User, orgs []coder.Organization) []coder.Organiz
3232
returnuserOrgs
3333
}
3434

35+
// getAllWorkspaces gets all workspaces for all users, on all providers.
36+
funcgetAllWorkspaces(ctx context.Context,client coder.Client) ([]coder.Workspace,error) {
37+
returnclient.Workspaces(ctx)
38+
}
39+
3540
// getWorkspaces returns all workspaces for the user.
3641
funcgetWorkspaces(ctx context.Context,client coder.Client,emailstring) ([]coder.Workspace,error) {
3742
user,err:=client.UserByEmail(ctx,email)
@@ -215,11 +220,9 @@ func getWorkspacesByProvider(ctx context.Context, client coder.Client, wpName, u
215220
returnnil,err
216221
}
217222

218-
ifuserEmail!="" {
219-
workspaces,err=filterWorkspacesByUser(ctx,client,userEmail,workspaces)
220-
iferr!=nil {
221-
returnnil,err
222-
}
223+
workspaces,err=filterWorkspacesByUser(ctx,client,userEmail,workspaces)
224+
iferr!=nil {
225+
returnnil,err
223226
}
224227

225228
returnworkspaces,nil

‎internal/cmd/workspaces.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,24 @@ func lsWorkspacesCommand() *cobra.Command {
8787
returnerr
8888
}
8989
varworkspaces []coder.Workspace
90-
if!all {
90+
ifall {
9191
varerrerror
92-
workspaces,err=getWorkspaces(ctx,client,user)
92+
workspaces,err=getAllWorkspaces(ctx,client)
9393
iferr!=nil {
9494
returnerr
9595
}
96-
}else {
97-
// If the user gave the all flag, then filtering by user doesn't make sense.
98-
user=""
99-
}
100-
ifprovider!=""||all {
96+
}elseifprovider!="" {
97+
varerrerror
10198
workspaces,err=getWorkspacesByProvider(ctx,client,provider,user)
10299
iferr!=nil {
103100
returnerr
104101
}
102+
}else {
103+
varerrerror
104+
workspaces,err=getWorkspaces(ctx,client,user)
105+
iferr!=nil {
106+
returnerr
107+
}
105108
}
106109
iflen(workspaces)<1 {
107110
clog.LogInfo("no workspaces found")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp