Skip to content

Commit

Permalink
Rework comment on passThroughOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
aweebit committed Aug 5, 2023
1 parent 7bad142 commit a8b656d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -1535,9 +1535,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
}
}

// If using passThroughOptions, stop processing options at first command-argument / unknown option.
// Processing after an unknown option is not possible because there is no way to know if the next argument is its option-argument and we should continue,
// or if it is a command-argument and we should stop.
// If using passThroughOptions, stop processing options at first command-argument.
// The processing is also stopped when an unknown option is encountered because
// - either allowUnknownOption is on and so the option is treated as a command-argument,
// - or it is off and so an error will be thrown anyway since no subcommand was found that could reprocess the option.
if (this._passThroughOptions) {
dest.push(arg);
if (args.length > 0) dest.push(...args);
Expand Down

0 comments on commit a8b656d

Please sign in to comment.