Skip to content
Myr

Rename allowunknown to allowUnknownOption

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

Rename `allowunknown` to `allowUnknownOption`

authored by zhiyelee · committed by zhiyelee · parent 79f04b3 · Browse files · 3 files+62 added−62 removed
This commit

State

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

Diff stats

3 files+62 added−62 removed

  • tests:+57 added−57 removed
  • other:+5 added−5 removed

3 files+62 added−62 removed

added:test/test.command.allowUnknownOption.js+57 added
deleted:test/test.options.allowUnknown.js-57 removed
modified:index.js+5 added-5 removed
80 unmodified lines
81function Command(name) {82 this.commands = [];83 this.options = [];84 this._execs = [];85 this._allowUnknown = false;85 this._allowUnknownOption = false;86 this._args = [];87 this._name = name;88}89
306 unmodified lines
396 * @param {Boolean} arg if `true` or omitted, no error will be thrown397 * for unknown options.398 * @api public399 */400Command.prototype.allowUnknown = function(arg) {401 this._allowUnknown = arguments.length === 0 || arg;400Command.prototype.allowUnknownOption = function(arg) {401 this._allowUnknownOption = arguments.length === 0 || arg;402 return this;403}403};404405/**406 * Parse `argv`, settings options and invoking commands when defined.407 *
299 unmodified lines
707 * @api private708 */709710Command.prototype.unknownOption = function(flag) {711 if(this._allowUnknown) return;711 if(this._allowUnknownOption) return;712 console.error();713 console.error(" error: unknown option `%s'", flag);714 console.error();715 process.exit(1);
305 unmodified lines