Skip to content

Commit 3d54bc0

Browse files
authored
feat: display current version on coder list (#11450)
* feat: display current version on coder list * fix make gen * update golden
1 parent 31f7b39 commit 3d54bc0

File tree

3 files changed

+34
-31
lines changed

3 files changed

+34
-31
lines changed

cli/list.go

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@ type workspaceListRow struct {
2222
codersdk.Workspace `table:"-"`
2323

2424
// For table format:
25-
WorkspaceName string `json:"-" table:"workspace,default_sort"`
26-
Template string `json:"-" table:"template"`
27-
Status string `json:"-" table:"status"`
28-
Healthy string `json:"-" table:"healthy"`
29-
LastBuilt string `json:"-" table:"last built"`
30-
Outdated bool `json:"-" table:"outdated"`
31-
StartsAt string `json:"-" table:"starts at"`
32-
StartsNext string `json:"-" table:"starts next"`
33-
StopsAfter string `json:"-" table:"stops after"`
34-
StopsNext string `json:"-" table:"stops next"`
35-
DailyCost string `json:"-" table:"daily cost"`
25+
WorkspaceName string `json:"-" table:"workspace,default_sort"`
26+
Template string `json:"-" table:"template"`
27+
Status string `json:"-" table:"status"`
28+
Healthy string `json:"-" table:"healthy"`
29+
LastBuilt string `json:"-" table:"last built"`
30+
CurrentVersion string `json:"-" table:"current version"`
31+
Outdated bool `json:"-" table:"outdated"`
32+
StartsAt string `json:"-" table:"starts at"`
33+
StartsNext string `json:"-" table:"starts next"`
34+
StopsAfter string `json:"-" table:"stops after"`
35+
StopsNext string `json:"-" table:"stops next"`
36+
DailyCost string `json:"-" table:"daily cost"`
3637
}
3738

3839
func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace) workspaceListRow {
@@ -46,18 +47,19 @@ func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace)
4647
healthy = strconv.FormatBool(workspace.Health.Healthy)
4748
}
4849
return workspaceListRow{
49-
Workspace: workspace,
50-
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
51-
Template: workspace.TemplateName,
52-
Status: status,
53-
Healthy: healthy,
54-
LastBuilt: durationDisplay(lastBuilt),
55-
Outdated: workspace.Outdated,
56-
StartsAt: schedRow.StartsAt,
57-
StartsNext: schedRow.StartsNext,
58-
StopsAfter: schedRow.StopsAfter,
59-
StopsNext: schedRow.StopsNext,
60-
DailyCost: strconv.Itoa(int(workspace.LatestBuild.DailyCost)),
50+
Workspace: workspace,
51+
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
52+
Template: workspace.TemplateName,
53+
Status: status,
54+
Healthy: healthy,
55+
LastBuilt: durationDisplay(lastBuilt),
56+
CurrentVersion: workspace.LatestBuild.TemplateVersionName,
57+
Outdated: workspace.Outdated,
58+
StartsAt: schedRow.StartsAt,
59+
StartsNext: schedRow.StartsNext,
60+
StopsAfter: schedRow.StopsAfter,
61+
StopsNext: schedRow.StopsNext,
62+
DailyCost: strconv.Itoa(int(workspace.LatestBuild.DailyCost)),
6163
}
6264
}
6365

@@ -73,6 +75,7 @@ func (r *RootCmd) list() *clibase.Cmd {
7375
"status",
7476
"healthy",
7577
"last built",
78+
"current version",
7679
"outdated",
7780
"starts at",
7881
"stops after",

cli/testdata/coder_list_--help.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ OPTIONS:
1111
-a, --all bool
1212
Specifies whether all workspaces will be listed or not.
1313

14-
-c, --column string-array (default: workspace,template,status,healthy,last built,outdated,starts at,stops after)
14+
-c, --column string-array (default: workspace,template,status,healthy,last built,current version,outdated,starts at,stops after)
1515
Columns to display in table output. Available columns: workspace,
16-
template, status, healthy, last built, outdated, starts at, starts
17-
next, stops after, stops next, daily cost.
16+
template, status, healthy, last built, current version, outdated,
17+
starts at, starts next, stops after, stops next, daily cost.
1818

1919
-o, --output string (default: table)
2020
Output format. Available formats: table, json.

docs/cli/list.md

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)