Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: display current version on coder list#11450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
f0ssel merged 3 commits intomainfromf0ssel/list-version
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletionscli/list.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,17 +22,18 @@ type workspaceListRow struct {
codersdk.Workspace `table:"-"`

// For table format:
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"`
StartsNext string `json:"-" table:"starts next"`
StopsAfter string `json:"-" table:"stops after"`
StopsNext string `json:"-" table:"stops next"`
DailyCost string `json:"-" table:"daily cost"`
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"`
CurrentVersion string `json:"-" table:"current version"`
Outdated bool `json:"-" table:"outdated"`
StartsAt string `json:"-" table:"starts at"`
StartsNext string `json:"-" table:"starts next"`
StopsAfter string `json:"-" table:"stops after"`
StopsNext string `json:"-" table:"stops next"`
DailyCost string `json:"-" table:"daily cost"`
}

func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace) workspaceListRow {
Expand All@@ -46,18 +47,19 @@ func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace)
healthy = strconv.FormatBool(workspace.Health.Healthy)
}
return workspaceListRow{
Workspace: workspace,
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
Template: workspace.TemplateName,
Status: status,
Healthy: healthy,
LastBuilt: durationDisplay(lastBuilt),
Outdated: workspace.Outdated,
StartsAt: schedRow.StartsAt,
StartsNext: schedRow.StartsNext,
StopsAfter: schedRow.StopsAfter,
StopsNext: schedRow.StopsNext,
DailyCost: strconv.Itoa(int(workspace.LatestBuild.DailyCost)),
Workspace: workspace,
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
Template: workspace.TemplateName,
Status: status,
Healthy: healthy,
LastBuilt: durationDisplay(lastBuilt),
CurrentVersion: workspace.LatestBuild.TemplateVersionName,
Outdated: workspace.Outdated,
StartsAt: schedRow.StartsAt,
StartsNext: schedRow.StartsNext,
StopsAfter: schedRow.StopsAfter,
StopsNext: schedRow.StopsNext,
DailyCost: strconv.Itoa(int(workspace.LatestBuild.DailyCost)),
}
}

Expand All@@ -73,6 +75,7 @@ func (r *RootCmd) list() *clibase.Cmd {
"status",
"healthy",
"last built",
"current version",
"outdated",
"starts at",
"stops after",
Expand Down
6 changes: 3 additions & 3 deletionscli/testdata/coder_list_--help.golden
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,10 +11,10 @@ OPTIONS:
-a, --all bool
Specifies whether all workspaces will be listed or not.

-c, --column string-array (default: workspace,template,status,healthy,last built,outdated,starts at,stops after)
-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,outdated, starts at, starts
next, stops after, stops next, daily cost.
template, status, healthy, last built,current version, outdated,
starts at, startsnext, stops after, stops next, daily cost.

-o, --output string (default: table)
Output format. Available formats: table, json.
Expand Down
10 changes: 5 additions & 5 deletionsdocs/cli/list.md
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.


[8]ページ先頭

©2009-2025 Movatter.jp