File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed
Expand file tree Collapse file tree 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("', '")}'`);
12721272 }
12731273 if ( this . _defaultCommandName ) {
12741274 // 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 ] ) ) {
12791276 this . emit ( 'option:' + this . _helpOption . name ( ) ) ;
12801277 }
12811278 return this . _dispatchSubcommand ( this . _defaultCommandName , operands , unknown ) ;
Original file line number Diff line number Diff line change @@ -220,13 +220,13 @@ class Option {
220220 /**
221221 * Check if `arg` matches the short or long flag.
222222 *
223- * @param {string } arg
223+ * @param {string | undefined } arg
224224 * @return {boolean }
225225 * @api private
226226 */
227227
228228 is ( arg ) {
229- return this . short === arg || this . long === arg ;
229+ return arg && ( this . short === arg || this . long === arg ) ;
230230 }
231231
232232 /**
You can’t perform that action at this time.
0 commit comments