Skip to content

Commit eeef56a

Browse files
authored
feat(cli): show workspace favorite status in list output (#11878)
1 parent 9abf6ec commit eeef56a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

cli/list.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type workspaceListRow struct {
2222
codersdk.Workspace `table:"-"`
2323

2424
// For table format:
25+
Favorite bool `json:"-" table:"favorite"`
2526
WorkspaceName string `json:"-" table:"workspace,default_sort"`
2627
Template string `json:"-" table:"template"`
2728
Status string `json:"-" table:"status"`
@@ -46,9 +47,15 @@ func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace)
4647
if status == "Starting" || status == "Started" {
4748
healthy = strconv.FormatBool(workspace.Health.Healthy)
4849
}
50+
favIco := " "
51+
if workspace.Favorite {
52+
favIco = "★"
53+
}
54+
workspaceName := favIco + " " + workspace.OwnerName + "/" + workspace.Name
4955
return workspaceListRow{
56+
Favorite: workspace.Favorite,
5057
Workspace: workspace,
51-
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
58+
WorkspaceName: workspaceName,
5259
Template: workspace.TemplateName,
5360
Status: status,
5461
Healthy: healthy,

cli/testdata/coder_list_--help.golden

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ OPTIONS:
1212
Specifies whether all workspaces will be listed or not.
1313

1414
-c, --column string-array (default: workspace,template,status,healthy,last built,current version,outdated,starts at,stops after)
15-
Columns to display in table output. Available columns: workspace,
16-
template, status, healthy, last built, current version, outdated,
17-
starts at, starts next, stops after, stops next, daily cost.
15+
Columns to display in table output. Available columns: favorite,
16+
workspace, template, status, healthy, last built, current version,
17+
outdated, 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

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)