File tree 2 files changed +3
-6
lines changed
2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -1272,10 +1272,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1272
1272
}
1273
1273
if ( this . _defaultCommandName ) {
1274
1274
// Run the help for default command from parent rather than passing to default command
1275
- const helpOptionProvided = this . _hasHelpOption && unknown . find (
1276
- arg => arg === this . _helpOption . long || arg === this . _helpOption . short
1277
- ) ;
1278
- if ( helpOptionProvided ) {
1275
+ if ( this . _hasHelpOption && this . _helpOption . is ( unknown [ 0 ] ) ) {
1279
1276
this . emit ( 'option:' + this . _helpOption . name ( ) ) ;
1280
1277
}
1281
1278
return this . _dispatchSubcommand ( this . _defaultCommandName , operands , unknown ) ;
Original file line number Diff line number Diff line change @@ -220,13 +220,13 @@ class Option {
220
220
/**
221
221
* Check if `arg` matches the short or long flag.
222
222
*
223
- * @param {string } arg
223
+ * @param {string | undefined } arg
224
224
* @return {boolean }
225
225
* @api private
226
226
*/
227
227
228
228
is ( arg ) {
229
- return this . short === arg || this . long === arg ;
229
+ return arg && ( this . short === arg || this . long === arg ) ;
230
230
}
231
231
232
232
/**
You can’t perform that action at this time.
0 commit comments