@@ -52,6 +52,7 @@ program
5252 . option ( '--user_columns' , 'include user columns in the report' )
5353 . option ( '--quiet' , 'only output report' )
5454 . option ( '--verbose' , 'show verbose output' )
55+ . option ( '--check_token' , 'check the access token' )
5556 . option ( '--show_without_times' , 'show issues/merge requests without time records' )
5657 . option ( '-p --proxy <proxy>' , 'use a proxy server with the given url' )
5758 . parse ( process . argv ) ;
9091 . set ( 'proxy' , program . proxy )
9192 . set ( 'type' , program . type )
9293 . set ( 'subgroups' , program . subgroups )
93- . set ( '_verbose' , program . verbose ) ;
94+ . set ( '_verbose' , program . verbose )
95+ . set ( '_checkToken' , program . check_token ) ;
9496
9597Cli . quiet = config . get ( 'quiet' ) ;
9698Cli . verbose = config . get ( '_verbose' ) ;
@@ -148,8 +150,9 @@ new Promise(resolve => {
148150 Cli . list ( `${ Cli . look } Resolving "${ projectLabels } "` ) ;
149151 let owner = new Owner ( config ) ;
150152
151- owner
152- . parallel ( projects , ( project , done ) => {
153+ owner . authorized ( )
154+ . catch ( e => Cli . x ( `Invalid access token!` , e ) )
155+ . then ( ( ) => owner . parallel ( projects , ( project , done ) => {
153156 config . set ( 'project' , project ) ;
154157
155158 switch ( config . get ( 'type' ) ) {
@@ -158,7 +161,7 @@ new Promise(resolve => {
158161 reports . push ( report ) ;
159162 report . getProject ( )
160163 . then ( ( ) => done ( ) )
161- . catch ( e => done ( e ) ) ;
164+ . catch ( e => Cli . x ( `Project not found or no access rights " ${ projectLabels } ". Run again with --check_token to see if your access token is invalid!` , e ) ) ;
162165 break ;
163166
164167 case 'group' :
@@ -175,7 +178,7 @@ new Promise(resolve => {
175178 . catch ( e => done ( e ) ) ;
176179 break ;
177180 }
178- } , 1 )
181+ } , 1 ) )
179182 . catch ( e => reject ( e ) )
180183 . then ( ( ) => {
181184 config . set ( 'project' , projects ) ;
0 commit comments