@@ -131,11 +131,23 @@ program
131
131
. description ( 'Get deployed target files for an environment' )
132
132
. option ( '-n, --network <value>' , 'The network to run off.' , x => x . toLowerCase ( ) , 'mainnet' )
133
133
. option ( '-c, --contract [value]' , 'The name of the contract' )
134
- . option ( '-k, --key [value]' , 'A specific key wanted' )
134
+ . option ( '-k, --key [value]' , 'A specific key wanted (ignored when using csv)' )
135
+ . option ( '-v, --csv' , 'Whether or not to CSV output the results' )
135
136
. option ( '-z, --use-ovm' , 'Target deployment for the OVM (Optimism).' )
136
- . action ( async ( { network, useOvm, contract, key } ) => {
137
+ . action ( async ( { network, useOvm, contract, key, csv } ) => {
137
138
const target = getTarget ( { network, useOvm, contract } ) ;
138
- console . log ( JSON . stringify ( key in target ? target [ key ] : target , null , 2 ) ) ;
139
+ if ( csv ) {
140
+ let headerComplete ;
141
+ for ( const entry of Object . values ( target ) ) {
142
+ if ( ! headerComplete ) {
143
+ console . log ( Object . keys ( entry ) . join ( ',' ) ) ;
144
+ headerComplete = true ;
145
+ }
146
+ console . log ( Object . values ( entry ) . join ( ',' ) ) ;
147
+ }
148
+ } else {
149
+ console . log ( JSON . stringify ( key in target ? target [ key ] : target , null , 2 ) ) ;
150
+ }
139
151
} ) ;
140
152
141
153
program
0 commit comments