Skip to content
Myr

Refactor _checkForBrokenPassThrough() to make it instance-aware

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Wee Bit · committed by Abe Tomoaki · parent ec1942d · Browse files · 1 file+5 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−7 removed

  • other:+5 added−7 removed

1 file+5 added−7 removed

modified:lib/command.js+5 added-7 removed
270 unmodified lines
271 if (opts.noHelp || opts.hidden) cmd._hidden = true; // modifying passed command due to existing implementation272273 this.commands.push(cmd);274 cmd.parent = this;275 this._checkForBrokenPassThrough(cmd, this);275 cmd._checkForBrokenPassThrough();276277 return this;278 }279
456 unmodified lines
736 * for unknown options.737 */738 passThroughOptions(passThrough = true) {739 this._passThroughOptions = !!passThrough;740 this._checkForBrokenPassThrough(this, this.parent);740 this._checkForBrokenPassThrough();741 return this;742 }743744 /**745 * @param {Command} command746 * @param {Command | null} parent745 * @api private746 */747750 _checkForBrokenPassThrough(command, parent) {751 if (parent && command._passThroughOptions && !parent._enablePositionalOptions) {752 throw new Error(`passThroughOptions cannot be used for '${command._name}' without turning on enablePositionalOptions for parent command(s)`);748 _checkForBrokenPassThrough() {749 if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) {750 throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`);751 }752 }753754 /**
1452 unmodified lines