@@ -86,6 +86,19 @@ const args = yargs(hideBin(process.argv))
8686 . option ( 'limit' , {
8787 default : 99 ,
8888 describe : 'Maximum number of CIs to get data from'
89+ } )
90+ . option ( 'since <date>' , {
91+ type : 'string' ,
92+ describe : 'Time since when the CI results should be queried'
93+ } ) . check ( argv => {
94+ try {
95+ // eslint-disable-next-line no-new
96+ new Date ( argv . since ) ;
97+ } catch {
98+ throw new Error ( '--since <date> should be string that can ' +
99+ 'be parsed by new Date()' ) ;
100+ }
101+ return true ;
89102 } ) ;
90103 } ,
91104 handler
@@ -421,7 +434,12 @@ class WalkCommand extends CICommand {
421434
422435 async initialize ( ) {
423436 const ciType = commandToType [ this . argv . type ] ;
424- const builds = await listBuilds ( this . cli , this . request , ciType ) ;
437+ const since = this . argv . since ? new Date ( this . argv . since ) : undefined ;
438+ const builds = await listBuilds ( this . cli , this . request , ciType , since ) ;
439+ if ( builds . count === 0 ) {
440+ this . cli . log ( 'No applicable builds found.' ) ;
441+ return ;
442+ }
425443 this . queue . push ( { type : 'health' , ciType, builds } ) ;
426444 for ( const build of builds . failed . slice ( 0 , this . argv . limit ) ) {
427445 this . queue . push ( build ) ;
@@ -430,6 +448,9 @@ class WalkCommand extends CICommand {
430448
431449 async aggregate ( ) {
432450 const { argv, cli } = this ;
451+ if ( this . queue . length === 0 ) {
452+ return ;
453+ }
433454 const aggregator = new FailureAggregator ( cli , this . json ) ;
434455 this . json = aggregator . aggregate ( ) ;
435456 cli . log ( '' ) ;
0 commit comments