Skip to content

Commit 7ae4cb5

Browse files
gnekichpetebacondarwin
authored andcommitted
feat: ✨ introduce json output for cf pages deployment list, as it enables other tools like jq to parse the data
1 parent e87198a commit 7ae4cb5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/wrangler/src/pages/deployments.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ export const pagesDeploymentListCommand = createCommand({
3333
choices: ["production", "preview"],
3434
description: "Environment type to list deployments for",
3535
},
36+
json: {
37+
type: "boolean",
38+
description: "Return output as clean JSON",
39+
default: false,
40+
},
3641
},
37-
async handler({ projectName, environment }) {
42+
async handler({ projectName, environment, json }) {
3843
const config = getConfigCache<PagesConfigCache>(
3944
PAGES_CONFIG_CACHE_FILENAME
4045
);
@@ -93,7 +98,11 @@ export const pagesDeploymentListCommand = createCommand({
9398
account_id: accountId,
9499
});
95100

96-
logger.table(data);
101+
if (json) {
102+
logger.log(JSON.stringify(data, null, 2));
103+
} else {
104+
logger.table(data);
105+
}
97106
metrics.sendMetricsEvent("list pages deployments");
98107
},
99108
});

0 commit comments

Comments
 (0)