diff --git a/cli/list.go b/cli/list.go
index f5f6408c47199..4b50ba16a7d34 100644
--- a/cli/list.go
+++ b/cli/list.go
@@ -2,6 +2,7 @@ package cli
import (
"fmt"
+ "strconv"
"time"
"github.com/google/uuid"
@@ -24,6 +25,7 @@ type workspaceListRow struct {
WorkspaceName string `json:"-" table:"workspace,default_sort"`
Template string `json:"-" table:"template"`
Status string `json:"-" table:"status"`
+ Healthy string `json:"-" table:"healthy"`
LastBuilt string `json:"-" table:"last built"`
Outdated bool `json:"-" table:"outdated"`
StartsAt string `json:"-" table:"starts at"`
@@ -51,12 +53,17 @@ func workspaceListRowFromWorkspace(now time.Time, usersByID map[uuid.UUID]coders
}
}
+ healthy := ""
+ if status == "Starting" || status == "Started" {
+ healthy = strconv.FormatBool(workspace.Health.Healthy)
+ }
user := usersByID[workspace.OwnerID]
return workspaceListRow{
Workspace: workspace,
WorkspaceName: user.Username + "/" + workspace.Name,
Template: workspace.TemplateName,
Status: status,
+ Healthy: healthy,
LastBuilt: durationDisplay(lastBuilt),
Outdated: workspace.Outdated,
StartsAt: autostartDisplay,
diff --git a/cli/testdata/coder_list_--help.golden b/cli/testdata/coder_list_--help.golden
index dfd7e69fcebfc..a9bb8218ba1c0 100644
--- a/cli/testdata/coder_list_--help.golden
+++ b/cli/testdata/coder_list_--help.golden
@@ -8,9 +8,10 @@ Aliases: ls
-a, --all bool
Specifies whether all workspaces will be listed or not.
- -c, --column string-array (default: workspace,template,status,last built,outdated,starts at,stops after)
+ -c, --column string-array (default: workspace,template,status,healthy,last built,outdated,starts at,stops after)
Columns to display in table output. Available columns: workspace,
- template, status, last built, outdated, starts at, stops after.
+ template, status, healthy, last built, outdated, starts at, stops
+ after.
-o, --output string (default: table)
Output format. Available formats: table, json.
diff --git a/docs/cli/list.md b/docs/cli/list.md
index 8a7da9c9e1ac7..7a1aa0defb052 100644
--- a/docs/cli/list.md
+++ b/docs/cli/list.md
@@ -26,12 +26,12 @@ Specifies whether all workspaces will be listed or not.
### -c, --column
-| | |
-| ------- | -------------------------------------------------------------------------------- |
-| Type | string-array
|
-| Default | workspace,template,status,last built,outdated,starts at,stops after
|
+| | |
+| ------- | ---------------------------------------------------------------------------------------- |
+| Type | string-array
|
+| Default | workspace,template,status,healthy,last built,outdated,starts at,stops after
|
-Columns to display in table output. Available columns: workspace, template, status, last built, outdated, starts at, stops after.
+Columns to display in table output. Available columns: workspace, template, status, healthy, last built, outdated, starts at, stops after.
### -o, --output