mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
committed by
GitHub
parent
616e1d7e9a
commit
dfac0745f3
@ -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,
|
||||
|
5
cli/testdata/coder_list_--help.golden
vendored
5
cli/testdata/coder_list_--help.golden
vendored
@ -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.
|
||||
|
@ -27,11 +27,11 @@ Specifies whether all workspaces will be listed or not.
|
||||
### -c, --column
|
||||
|
||||
| | |
|
||||
| ------- | -------------------------------------------------------------------------------- |
|
||||
| ------- | ---------------------------------------------------------------------------------------- |
|
||||
| Type | <code>string-array</code> |
|
||||
| Default | <code>workspace,template,status,last built,outdated,starts at,stops after</code> |
|
||||
| Default | <code>workspace,template,status,healthy,last built,outdated,starts at,stops after</code> |
|
||||
|
||||
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
|
||||
|
||||
|
Reference in New Issue
Block a user