@@ -12,30 +12,6 @@ const Yargs = require('yargs/yargs');
1212const packageJson = require ( '../package.json' ) ;
1313const modulename = require ( '..' ) ;
1414
15- /** Calls <code>yargs.parse</code> and passes any thrown errors to the callback.
16- * Workaround for https://github.com/yargs/yargs/issues/755
17- * @private
18- */
19- function parseYargs ( yargs , args , callback ) {
20- // Since yargs doesn't nextTick its callback, this function must be careful
21- // that exceptions thrown from callback (which propagate through yargs.parse)
22- // are not caught and passed to a second invocation of callback.
23- let called = false ;
24- try {
25- yargs . parse ( args , function ( ...cbargs ) {
26- called = true ;
27- return callback . apply ( this , cbargs ) ;
28- } ) ;
29- } catch ( err ) {
30- if ( called ) {
31- // err was thrown after or by callback. Let it propagate.
32- throw err ;
33- } else {
34- callback ( err ) ;
35- }
36- }
37- }
38-
3915/** Options for command entry points.
4016 *
4117 * @typedef {{
@@ -114,7 +90,7 @@ function modulenameCmd(args, options, callback) {
11490 . version ( `${ packageJson . name } ${ packageJson . version } ` )
11591 . alias ( 'version' , 'V' )
11692 . strict ( ) ;
117- parseYargs ( yargs , args , ( err , argOpts , output ) => {
93+ yargs . parse ( args , ( err , argOpts , output ) => {
11894 if ( err ) {
11995 if ( output ) {
12096 options . stderr . write ( `${ output } \n` ) ;
0 commit comments