mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add JSON output format to many CLI commands (#6082)
This commit is contained in:
+8
-6
@@ -7,12 +7,14 @@ Aliases:
|
||||
list, ls
|
||||
|
||||
Flags:
|
||||
-a, --all Specifies whether all workspaces will be listed or not.
|
||||
-c, --column stringArray Specify a column to filter in the table. Available columns are:
|
||||
workspace, template, status, last_built, outdated, starts_at,
|
||||
stops_after
|
||||
-h, --help help for list
|
||||
--search string Search for a workspace with a query. (default "owner:me")
|
||||
-a, --all Specifies whether all workspaces will be listed or not.
|
||||
-c, --column strings Columns to display in table output. Available columns: workspace,
|
||||
template, status, last built, outdated, starts at, stops after
|
||||
(default [workspace,template,status,last built,outdated,starts
|
||||
at,stops after])
|
||||
-h, --help help for list
|
||||
-o, --output string Output format. Available formats: table, json (default "table")
|
||||
--search string Search for a workspace with a query. (default "owner:me")
|
||||
|
||||
Global Flags:
|
||||
--global-config coder Path to the global coder config directory.
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
[
|
||||
{
|
||||
"id": "[workspace ID]",
|
||||
"created_at": "[timestamp]",
|
||||
"updated_at": "[timestamp]",
|
||||
"owner_id": "[first user ID]",
|
||||
"owner_name": "testuser",
|
||||
"template_id": "[template ID]",
|
||||
"template_name": "test-template",
|
||||
"template_display_name": "",
|
||||
"template_icon": "",
|
||||
"template_allow_user_cancel_workspace_jobs": false,
|
||||
"latest_build": {
|
||||
"id": "[workspace build ID]",
|
||||
"created_at": "[timestamp]",
|
||||
"updated_at": "[timestamp]",
|
||||
"workspace_id": "[workspace ID]",
|
||||
"workspace_name": "test-workspace",
|
||||
"workspace_owner_id": "[first user ID]",
|
||||
"workspace_owner_name": "testuser",
|
||||
"template_version_id": "[version ID]",
|
||||
"template_version_name": "[version name]",
|
||||
"build_number": 1,
|
||||
"transition": "start",
|
||||
"initiator_id": "[first user ID]",
|
||||
"initiator_name": "testuser",
|
||||
"job": {
|
||||
"id": "[workspace build job ID]",
|
||||
"created_at": "[timestamp]",
|
||||
"started_at": "[timestamp]",
|
||||
"completed_at": "[timestamp]",
|
||||
"status": "succeeded",
|
||||
"worker_id": "[workspace build worker ID]",
|
||||
"file_id": "[workspace build file ID]",
|
||||
"tags": {
|
||||
"scope": "organization"
|
||||
}
|
||||
},
|
||||
"reason": "initiator",
|
||||
"resources": [],
|
||||
"deadline": "[timestamp]",
|
||||
"status": "running",
|
||||
"daily_cost": 0
|
||||
},
|
||||
"outdated": false,
|
||||
"name": "test-workspace",
|
||||
"autostart_schedule": "CRON_TZ=US/Central 30 9 * * 1-5",
|
||||
"ttl_ms": 28800000,
|
||||
"last_used_at": "[timestamp]"
|
||||
}
|
||||
]
|
||||
+5
-3
@@ -7,9 +7,11 @@ Aliases:
|
||||
list, ls
|
||||
|
||||
Flags:
|
||||
-c, --column stringArray Specify a column to filter in the table. (default
|
||||
[name,last_updated,used_by])
|
||||
-h, --help help for list
|
||||
-c, --column strings Columns to display in table output. Available columns: name, created
|
||||
at, last updated, organization id, provisioner, active version id,
|
||||
used by, default ttl (default [name,last updated,used by])
|
||||
-h, --help help for list
|
||||
-o, --output string Output format. Available formats: table, json (default "table")
|
||||
|
||||
Global Flags:
|
||||
--global-config coder Path to the global coder config directory.
|
||||
|
||||
@@ -4,7 +4,11 @@ Usage:
|
||||
coder templates versions list <template> [flags]
|
||||
|
||||
Flags:
|
||||
-h, --help help for list
|
||||
-c, --column strings Columns to display in table output. Available columns: name, created
|
||||
at, created by, status, active (default [name,created at,created
|
||||
by,status,active])
|
||||
-h, --help help for list
|
||||
-o, --output string Output format. Available formats: table, json (default "table")
|
||||
|
||||
Global Flags:
|
||||
--global-config coder Path to the global coder config directory.
|
||||
|
||||
+4
-1
@@ -7,7 +7,10 @@ Aliases:
|
||||
list, ls
|
||||
|
||||
Flags:
|
||||
-h, --help help for list
|
||||
-c, --column strings Columns to display in table output. Available columns: id, last used,
|
||||
expires at, created at (default [id,last used,expires at,created at])
|
||||
-h, --help help for list
|
||||
-o, --output string Output format. Available formats: table, json (default "table")
|
||||
|
||||
Global Flags:
|
||||
--global-config coder Path to the global coder config directory.
|
||||
|
||||
+4
-5
@@ -5,11 +5,10 @@ Aliases:
|
||||
list, ls
|
||||
|
||||
Flags:
|
||||
-c, --column stringArray Specify a column to filter in the table. Available columns are:
|
||||
id, username, email, created_at, status. (default
|
||||
[username,email,created_at,status])
|
||||
-h, --help help for list
|
||||
-o, --output string Output format. Available formats are: table, json. (default "table")
|
||||
-c, --column strings Columns to display in table output. Available columns: id, username,
|
||||
email, created at, status (default [username,email,created_at,status])
|
||||
-h, --help help for list
|
||||
-o, --output string Output format. Available formats: table, json (default "table")
|
||||
|
||||
Global Flags:
|
||||
--global-config coder Path to the global coder config directory.
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
[
|
||||
{
|
||||
"id": "[first user ID]",
|
||||
"username": "testuser",
|
||||
"email": "testuser@coder.com",
|
||||
"created_at": "[timestamp]",
|
||||
"last_seen_at": "[timestamp]",
|
||||
"status": "active",
|
||||
"organization_ids": [
|
||||
"[first org ID]"
|
||||
],
|
||||
"roles": [
|
||||
{
|
||||
"name": "owner",
|
||||
"display_name": "Owner"
|
||||
}
|
||||
],
|
||||
"avatar_url": ""
|
||||
},
|
||||
{
|
||||
"id": "[second user ID]",
|
||||
"username": "testuser2",
|
||||
"email": "testuser2@coder.com",
|
||||
"created_at": "[timestamp]",
|
||||
"last_seen_at": "[timestamp]",
|
||||
"status": "active",
|
||||
"organization_ids": [
|
||||
"[first org ID]"
|
||||
],
|
||||
"roles": [],
|
||||
"avatar_url": ""
|
||||
}
|
||||
]
|
||||
+1
-1
@@ -8,7 +8,7 @@ Get Started:
|
||||
|
||||
Flags:
|
||||
-h, --help help for show
|
||||
-o, --output string Output format. Available formats are: table, json. (default "table")
|
||||
-o, --output string Output format. Available formats: table, json (default "table")
|
||||
|
||||
Global Flags:
|
||||
--global-config coder Path to the global coder config directory.
|
||||
|
||||
Reference in New Issue
Block a user