Skip to content

chore: use workspace name as arg in coder workspaces create #1007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
presort templates
  • Loading branch information
coadler committed Apr 14, 2022
commit 154d2b4fd2ea1ae0d53ef77794301c6d2294e5e0
7 changes: 4 additions & 3 deletions cli/workspacecreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func workspaceCreate() *cobra.Command {
return err
}

slices.SortFunc(templates, func(a, b codersdk.Template) bool {
return a.WorkspaceOwnerCount > b.WorkspaceOwnerCount
})

templateNames := make([]string, 0, len(templates))
templateByName := make(map[string]codersdk.Template, len(templates))

Expand All @@ -85,9 +89,6 @@ func workspaceCreate() *cobra.Command {
templateNames = append(templateNames, templateName)
templateByName[templateName] = template
}
slices.SortFunc(templateNames, func(a, b string) bool {
return templateByName[a].WorkspaceOwnerCount > templateByName[b].WorkspaceOwnerCount
})

// Move the cursor up a single line for nicer display!
option, err := cliui.Select(cmd, cliui.SelectOptions{
Expand Down