File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
src/interactionModelGeneration Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -293,15 +293,20 @@ export class InteractionModelGenerator {
293
293
}
294
294
295
295
/**
296
- * Build the interaction model and write to disk.
296
+ * Build the interaction model and write to disk or standard output .
297
297
*
298
- * @param filename - Filename
298
+ * @param filename - Filename(optional)
299
299
*/
300
- buildAndWrite ( filename : string ) {
300
+ buildAndWrite ( filename ? : string ) {
301
301
const interactionModelJson : string = JSON . stringify ( this . build ( ) , null , 2 ) ;
302
- const path : string = join ( process . cwd ( ) , filename ) ;
303
- fs . writeFileSync ( path , interactionModelJson ) ;
304
- log . info ( `Wrote interactionModel: ${ path } ` ) ;
302
+ if ( filename === undefined ) {
303
+ process . stdout . write ( interactionModelJson ) ;
304
+ log . info ( 'Wrote to standard output' ) ;
305
+ } else {
306
+ const path : string = join ( process . cwd ( ) , filename ) ;
307
+ fs . writeFileSync ( path , interactionModelJson ) ;
308
+ log . info ( `Wrote interactionModel: ${ path } ` ) ;
309
+ }
305
310
}
306
311
}
307
312
You can’t perform that action at this time.
0 commit comments