File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -361,22 +361,24 @@ function parseOptions(args) {
361
361
} ;
362
362
363
363
for ( let i = 0 ; i < args . length ; ++ i ) {
364
- if ( Object . prototype . hasOwnProperty . call ( correspondences , args [ i ] ) ) {
364
+ const arg = args [ i ] ;
365
+ if ( Object . prototype . hasOwnProperty . call ( correspondences , arg ) ) {
365
366
i += 1 ;
366
367
if ( i >= args . length ) {
367
- console . log ( "Missing argument after `" + args [ i - 1 ] + "` option." ) ;
368
+ console . log ( "Missing argument after `" + arg + "` option." ) ;
368
369
return null ;
369
370
}
370
- if ( args [ i - 1 ] !== "--test-file" ) {
371
- opts [ correspondences [ args [ i - 1 ] ] ] = args [ i ] ;
371
+ const arg_value = args [ i ] ;
372
+ if ( arg !== "--test-file" ) {
373
+ opts [ correspondences [ arg ] ] = arg_value ;
372
374
} else {
373
- opts [ correspondences [ args [ i - 1 ] ] ] . push ( args [ i ] ) ;
375
+ opts [ correspondences [ arg ] ] . push ( arg_value ) ;
374
376
}
375
- } else if ( args [ i ] === "--help" ) {
377
+ } else if ( arg === "--help" ) {
376
378
showHelp ( ) ;
377
379
process . exit ( 0 ) ;
378
380
} else {
379
- console . log ( "Unknown option `" + args [ i ] + "`." ) ;
381
+ console . log ( "Unknown option `" + arg + "`." ) ;
380
382
console . log ( "Use `--help` to see the list of options" ) ;
381
383
return null ;
382
384
}
You can’t perform that action at this time.
0 commit comments