Skip to content

Commit

Permalink
Use weaker wording: "broken" instead of "illegal"
Browse files Browse the repository at this point in the history
  • Loading branch information
aweebit authored and abetomo committed Aug 5, 2023
1 parent 1453bdf commit c60ce9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class Command extends EventEmitter {

this.commands.push(cmd);
cmd.parent = this;
this._checkForIllegalPassThroughOptions(cmd, this);
this._checkForBrokenPassThrough(cmd, this);

return this;
}
Expand Down Expand Up @@ -737,7 +737,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
*/
passThroughOptions(passThrough = true) {
this._passThroughOptions = !!passThrough;
this._checkForIllegalPassThroughOptions(this, this.parent);
this._checkForBrokenPassThrough(this, this.parent);
return this;
}

Expand All @@ -747,7 +747,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
* @api private
*/

_checkForIllegalPassThroughOptions(command, parent) {
_checkForBrokenPassThrough(command, parent) {
if (parent && command._passThroughOptions && !parent._enablePositionalOptions) {
throw new Error(`passThroughOptions cannot be used for '${command._name}' without turning on enablePositionalOptions for parent command${parent._name ? ` '${parent._name}'` : ''}`);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/command.positionalOptions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ describe('program with action handler and positionalOptions and subcommand', ()

// ------------------------------------------------------------------------------

describe('illegal passThroughOptions', () => {
describe('broken passThrough', () => {
test('when program not positional and turn on passThroughOptions in subcommand then error', () => {
const program = new commander.Command();
const sub = program.command('sub');
Expand Down

0 comments on commit c60ce9d

Please sign in to comment.