[wrangler] Add --json flag to pages project list command#12465
[wrangler] Add --json flag to pages project list command#12465petebacondarwin merged 4 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 39f355f The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Claude finished @petebacondarwin's task —— View job Changeset ReviewReviewed Todo:
✅ All changesets look good The changeset properly:
The description clearly explains what the feature does and why it's useful, with a practical example showing the expected output format. Cuteness Report: This is Claude. He's a spinning loading indicator and doesn't even know he's working overtime. Very dedicated. 14/10 would spin again. 🔄 |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
Closes #4140 This adds a --json flag to the 'wrangler pages project list' command that outputs the project list as clean JSON instead of a formatted table. This enables easier programmatic processing and scripting workflows. Changes: - Added json argument to pagesProjectListCommand - Added printBanner behavior to suppress banner when --json is used - Updated handler to conditionally output JSON or table - Added tests for JSON output and banner suppression
7bae777 to
90d3ff6
Compare
| args: { | ||
| json: { | ||
| type: "boolean", | ||
| description: "Return output as clean JSON", |
There was a problem hiding this comment.
| description: "Return output as clean JSON", | |
| description: "Return output as JSON", |
There was a problem hiding this comment.
This phrasing is used throughout the code base...
27 results - 24 files
packages/wrangler/CHANGELOG.md:
6561
6562: ⟪ 286 characters skipped ⟫erimental-versions`, `wrangler deployments status --experimental-versions`, `wrangler versions list --experimental-versions` and `wrangler versions view --experimental-versions` which will format the output as clean JSON. The ` --experimental-versions` flag is still required for these commands.
6563
8194 --timestamp accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for [string]
8195: --json return output as clean JSON [boolean] [default: false]
8196
8200 --timestamp accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for [string]
8201: --json return output as clean JSON [boolean] [default: false]
8202 ```
packages/wrangler/src/__tests__/vectorize/vectorize.test.ts:
124 OPTIONS
125: --json Return output as clean JSON [boolean] [default: false]
126 --deprecated-v1 Fetch a deprecated V1 Vectorize index. This must be enabled if the index was created with V1 option. [boolean] [default: false]"
925 --cursor Cursor for pagination to get the next page of results [string]
926: --json Return output as clean JSON [boolean] [default: false]
927
packages/wrangler/src/ai/listCatalog.ts:
17 type: "boolean",
18: description: "Return output as clean JSON",
19 default: false,
packages/wrangler/src/ai/listFinetune.ts:
18 type: "boolean",
19: description: "Return output as clean JSON",
20 default: false,
packages/wrangler/src/d1/execute.ts:
93 type: "boolean",
94: description: "Return output as clean JSON",
95 default: false,
packages/wrangler/src/d1/info.ts:
30 type: "boolean",
31: description: "Return output as clean JSON",
32 default: false,
packages/wrangler/src/d1/insights.ts:
109 type: "boolean",
110: description: "return output as clean JSON",
111 default: false,
packages/wrangler/src/d1/list.ts:
20 type: "boolean",
21: description: "Return output as clean JSON",
22 default: false,
packages/wrangler/src/d1/timeTravel/info.ts:
35 type: "boolean",
36: description: "Return output as clean JSON",
37 default: false,
packages/wrangler/src/d1/timeTravel/restore.ts:
43 type: "boolean",
44: description: "Return output as clean JSON",
45 default: false,
packages/wrangler/src/pages/deployments.ts:
40 type: "boolean",
41: description: "Return output as clean JSON",
42 default: false,
packages/wrangler/src/pages/projects.ts:
31 type: "boolean",
32: description: "Return output as clean JSON",
33 default: false,
packages/wrangler/src/vectorize/create.ts:
57 default: false,
58: description: "Return output as clean JSON",
59 },
packages/wrangler/src/vectorize/get.ts:
23 default: false,
24: description: "Return output as clean JSON",
25 },
packages/wrangler/src/vectorize/info.ts:
20 json: {
21: describe: "return output as clean JSON",
22 type: "boolean",
packages/wrangler/src/vectorize/insert.ts:
45 json: {
46: describe: "return output as clean JSON",
47 type: "boolean",
packages/wrangler/src/vectorize/list.ts:
18 default: false,
19: description: "Return output as clean JSON",
20 },
packages/wrangler/src/vectorize/listMetadataIndex.ts:
21 json: {
22: describe: "return output as clean JSON",
23 type: "boolean",
packages/wrangler/src/vectorize/listVectors.ts:
44 default: false,
45: description: "Return output as clean JSON",
46 },
packages/wrangler/src/vectorize/upsert.ts:
42 json: {
43: describe: "return output as clean JSON",
44 type: "boolean",
packages/wrangler/src/versions/list.ts:
27 json: {
28: describe: "Display output as clean JSON",
29 type: "boolean",
packages/wrangler/src/versions/view.ts:
35 json: {
36: describe: "Display output as clean JSON",
37 type: "boolean",
packages/wrangler/src/versions/deployments/list.ts:
27 json: {
28: describe: "Display output as clean JSON",
29 type: "boolean",
packages/wrangler/src/versions/deployments/status.ts:
27 json: {
28: describe: "Display output as clean JSON",
29 type: "boolean",
If it was good enough to land previously, then this is definitely a nit.
There was a problem hiding this comment.
If it was good enough to land previously, then this is definitely a nit.
We should clean existing code.
There was a problem hiding this comment.
Not in this PR 😄
|
Can I confirm that all these suggestions are nits, which makes me surprised that you block the PR on those. |
vicb
left a comment
There was a problem hiding this comment.
Thanks for the update 🚀
Looks like the CI is unhappy because github is down :(
Fixes #4140.
This adds a
--jsonflag to thewrangler pages project listcommand that outputs the project list as clean JSON instead of a formatted table. This enables easier programmatic processing and scripting workflows.Example usage:
Changes:
jsonargument topagesProjectListCommandwith typebooleanand defaultfalseprintBanner: (args) => !args.jsonbehavior to suppress the banner when JSON output is requestedJSON.stringify(data, null, 2)) or tableThis follows the same pattern used by other wrangler commands like
wrangler pages deployment list --json,wrangler d1 list --json, andwrangler queues list --json.--jsonflag forpages project listcommand cloudflare-docs#28175A picture of a cute animal (not mandatory, but encouraged)
🐕