feat: add JSON output format to many CLI commands (#6082)

This commit is contained in:
Dean Sheather
2023-02-08 17:09:38 +00:00
committed by GitHub
parent 5655ec6862
commit d60ec3e4bf
36 changed files with 851 additions and 285 deletions
+8 -6
View File
@@ -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
View File
@@ -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
View File
@@ -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.
+5 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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.
+33
View File
@@ -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
View File
@@ -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.