File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
packages/wrangler/src/pages Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,19 @@ export function ListOptions(yargs: CommonYargsArgv) {
2828 choices : [ "production" , "preview" ] ,
2929 description : "Environment type to list deployments for" ,
3030 } ,
31+ json : {
32+ type : "boolean" ,
33+ description : "Return output as clean JSON" ,
34+ default : false ,
35+ } ,
3136 } ) ;
3237}
3338
34- export async function ListHandler ( { projectName, environment } : ListArgs ) {
39+ export async function ListHandler ( {
40+ projectName,
41+ environment,
42+ json,
43+ } : ListArgs ) {
3544 const config = getConfigCache < PagesConfigCache > ( PAGES_CONFIG_CACHE_FILENAME ) ;
3645 const accountId = await requireAuth ( config ) ;
3746
@@ -72,6 +81,7 @@ export async function ListHandler({ projectName, environment }: ListArgs) {
7281
7382 const data = deployments . map ( ( deployment ) => {
7483 return {
84+ Id : deployment . id ,
7585 Environment : titleCase ( deployment . environment ) ,
7686 Branch : deployment . deployment_trigger . metadata . branch ,
7787 Source : shortSha ( deployment . deployment_trigger . metadata . commit_hash ) ,
@@ -86,6 +96,10 @@ export async function ListHandler({ projectName, environment }: ListArgs) {
8696 account_id : accountId ,
8797 } ) ;
8898
89- logger . table ( data ) ;
99+ if ( json ) {
100+ logger . log ( JSON . stringify ( data , null , 2 ) ) ;
101+ } else {
102+ logger . table ( data ) ;
103+ }
90104 metrics . sendMetricsEvent ( "list pages deployments" ) ;
91105}
You can’t perform that action at this time.
0 commit comments