@@ -51,6 +51,7 @@ program
5151 . option ( '--merge_request_columns <columns>' , 'include the given columns in the merge request part of the report' , collect , null )
5252 . option ( '--user_columns' , 'include user columns in the report' )
5353 . option ( '--quiet' , 'only output report' )
54+ . option ( '--verbose' , 'show verbose output' )
5455 . option ( '--show_without_times' , 'show issues/merge requests without time records' )
5556 . option ( '-p --proxy <proxy>' , 'use a proxy server with the given url' )
5657 . parse ( process . argv ) ;
@@ -88,13 +89,26 @@ config
8889 . set ( 'userColumns' , program . user_columns )
8990 . set ( 'proxy' , program . proxy )
9091 . set ( 'type' , program . type )
91- . set ( 'subgroups' , program . subgroups ) ;
92+ . set ( 'subgroups' , program . subgroups )
93+ . set ( '_verbose' , program . verbose ) ;
9294
9395Cli . quiet = config . get ( 'quiet' ) ;
96+ Cli . verbose = config . get ( '_verbose' ) ;
97+
98+
99+ // create stuff
100+ let reports = new ReportCollection ( config ) ,
101+ master = new Report ( config ) ,
102+ projectLabels = _ . isArray ( config . get ( 'project' ) ) ? config . get ( 'project' ) . join ( '", "' ) : config . get ( 'project' ) ,
103+ projects = _ . isArray ( config . get ( 'project' ) ) ? config . get ( 'project' ) : [ config . get ( 'project' ) ] ,
104+ output ;
94105
95106// warnings
96107if ( config . get ( 'iids' ) . length > 1 && config . get ( 'query' ) . length > 1 ) {
97- Cli . warn ( `The ids argument is ignored when querying multiple data types` ) ;
108+ Cli . warn ( `The ids argument is ignored when querying issues and merge requests` ) ;
109+ }
110+ if ( config . get ( 'iids' ) . length > 1 && ( config . get ( 'type' ) !== 'project' || projects . length > 1 ) ) {
111+ Cli . warn ( `The ids argument is ignored when querying multiple projects` ) ;
98112}
99113if ( ( config . get ( 'report' ) . includes ( 'issues' ) && ! config . get ( 'query' ) . includes ( 'issues' ) ) ) {
100114 Cli . warn ( `Issues are included in the report but not queried.` ) ;
@@ -115,11 +129,6 @@ if (!config.get('to').isValid()) {
115129 Cli . error ( `TO is not a in valid ISO date format.` ) ;
116130}
117131
118- // create stuff
119- let reports = new ReportCollection ( config ) ,
120- master = new Report ( config ) ,
121- output ;
122-
123132// file prompt
124133new Promise ( resolve => {
125134 if ( config . get ( 'file' ) && fs . existsSync ( config . get ( 'file' ) ) ) {
@@ -133,36 +142,46 @@ new Promise(resolve => {
133142
134143// get project(s)
135144 . then ( ( ) => new Promise ( ( resolve , reject ) => {
136- Cli . list ( `${ Cli . look } Resolving "${ config . get ( 'project' ) } "` ) ;
145+ Cli . list ( `${ Cli . look } Resolving "${ projectLabels } "` ) ;
137146 let owner = new Owner ( config ) ;
138147
139- switch ( config . get ( 'type' ) ) {
140- case 'project' :
141- let report = new Report ( config ) ;
142- reports . push ( report ) ;
143- report . getProject ( )
144- . then ( ( ) => resolve ( ) )
145- . catch ( e => reject ( e ) ) ;
146- break ;
147-
148- case 'group' :
149- owner . getGroup ( )
150- . then ( ( ) => {
151- if ( ! config . get ( 'subgroups' ) ) return new Promise ( r => r ( ) ) ;
152- return owner . getSubGroups ( ) ;
153- } )
154- . then ( ( ) => owner . getProjectsByGroup ( )
155- . then ( ( ) => {
156- owner . projects . forEach ( project => {
157- reports . push ( new Report ( config , project ) ) ;
158- } ) ;
159- Cli . out ( `\r${ Cli . look } Selected projects: ${ owner . listProjects ( ) } \n` ) ;
160- resolve ( ) ;
161- } ) )
162- . catch ( e => reject ( e ) ) ;
163- break ;
164- }
148+ owner
149+ . parallel ( projects , ( project , done ) => {
150+ config . set ( 'project' , project ) ;
151+
152+ switch ( config . get ( 'type' ) ) {
153+ case 'project' :
154+ let report = new Report ( config ) ;
155+ reports . push ( report ) ;
156+ report . getProject ( )
157+ . then ( ( ) => done ( ) )
158+ . catch ( e => done ( e ) ) ;
159+ break ;
160+
161+ case 'group' :
162+ owner . getGroup ( )
163+ . then ( ( ) => {
164+ if ( ! config . get ( 'subgroups' ) ) return new Promise ( r => r ( ) ) ;
165+ return owner . getSubGroups ( ) ;
166+ } )
167+ . then ( ( ) => owner . getProjectsByGroup ( )
168+ . then ( ( ) => {
169+ owner . projects . forEach ( project => {
170+ reports . push ( new Report ( config , project ) ) ;
171+ } ) ;
172+ done ( ) ;
173+ } ) )
174+ . catch ( e => done ( e ) ) ;
175+ break ;
176+ }
177+ } , 1 )
178+ . catch ( e => reject ( e ) )
179+ . then ( ( ) => {
180+ config . set ( 'project' , projects ) ;
181+ resolve ( ) ;
182+ } ) ;
165183 } ) )
184+ . then ( ( ) => Cli . out ( `\r${ Cli . look } Selected projects: ${ reports . reports . map ( r => r . project . name . bold . blue ) . join ( ', ' ) } \n` ) )
166185
167186 // get members and user columns
168187 . then ( ( ) => new Promise ( resolve => {
@@ -185,7 +204,7 @@ new Promise(resolve => {
185204 . then ( ( ) => resolve ( ) ) ;
186205 } ) )
187206 . then ( ( ) => Cli . mark ( ) )
188- . catch ( error => Cli . x ( `Could not resolve "${ config . get ( 'project' ) } "` , error ) )
207+ . catch ( error => Cli . x ( `Could not resolve "${ projectLabels } "` , error ) )
189208
190209 // get issues
191210 . then ( ( ) => new Promise ( resolve => {
0 commit comments