mirror of https://github.com/coder/coder.git
feat(cli): show workspace favorite status in list output (#11878)
This commit is contained in:
parent
9abf6ec170
commit
eeef56a655
|
@ -22,6 +22,7 @@ type workspaceListRow struct {
|
|||
codersdk.Workspace `table:"-"`
|
||||
|
||||
// For table format:
|
||||
Favorite bool `json:"-" table:"favorite"`
|
||||
WorkspaceName string `json:"-" table:"workspace,default_sort"`
|
||||
Template string `json:"-" table:"template"`
|
||||
Status string `json:"-" table:"status"`
|
||||
|
@ -46,9 +47,15 @@ func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace)
|
|||
if status == "Starting" || status == "Started" {
|
||||
healthy = strconv.FormatBool(workspace.Health.Healthy)
|
||||
}
|
||||
favIco := " "
|
||||
if workspace.Favorite {
|
||||
favIco = "★"
|
||||
}
|
||||
workspaceName := favIco + " " + workspace.OwnerName + "/" + workspace.Name
|
||||
return workspaceListRow{
|
||||
Favorite: workspace.Favorite,
|
||||
Workspace: workspace,
|
||||
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
|
||||
WorkspaceName: workspaceName,
|
||||
Template: workspace.TemplateName,
|
||||
Status: status,
|
||||
Healthy: healthy,
|
||||
|
|
|
@ -12,9 +12,9 @@ OPTIONS:
|
|||
Specifies whether all workspaces will be listed or not.
|
||||
|
||||
-c, --column string-array (default: workspace,template,status,healthy,last built,current version,outdated,starts at,stops after)
|
||||
Columns to display in table output. Available columns: workspace,
|
||||
template, status, healthy, last built, current version, outdated,
|
||||
starts at, starts next, stops after, stops next, daily cost.
|
||||
Columns to display in table output. Available columns: favorite,
|
||||
workspace, template, status, healthy, last built, current version,
|
||||
outdated, starts at, starts next, stops after, stops next, daily cost.
|
||||
|
||||
-o, --output string (default: table)
|
||||
Output format. Available formats: table, json.
|
||||
|
|
|
@ -31,7 +31,7 @@ Specifies whether all workspaces will be listed or not.
|
|||
| Type | <code>string-array</code> |
|
||||
| Default | <code>workspace,template,status,healthy,last built,current version,outdated,starts at,stops after</code> |
|
||||
|
||||
Columns to display in table output. Available columns: workspace, template, status, healthy, last built, current version, outdated, starts at, starts next, stops after, stops next, daily cost.
|
||||
Columns to display in table output. Available columns: favorite, workspace, template, status, healthy, last built, current version, outdated, starts at, starts next, stops after, stops next, daily cost.
|
||||
|
||||
### -o, --output
|
||||
|
||||
|
|
Loading…
Reference in New Issue