Skip to content
Myr

all unknownArg

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

authored by Craig Andrews · committed by zhiyelee · parent 1444cf3 · Browse files · 1 file+13 added−1 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+13 added−1 removed

  • other:+13 added−1 removed

1 file+13 added−1 removed

modified:index.js+13 added-1 removed
80 unmodified lines
81function Command(name) {82 this.commands = [];83 this.options = [];84 this._execs = [];85 this._allow_unknown = false;86 this._args = [];87 this._name = name;88}89
302 unmodified lines
392 return this;393};394395/**396 * Allow unknown options on the command line.397 *398 * @param {Boolean} allow399 * @api public400 */401Command.prototype.allowUnknown = function(allow) {402 this._allow_unknown = allow === undefined ? false : allow;403 return this;404}405406/**407 * Parse `argv`, settings options and invoking commands when defined.408 *409 * @param {Array} argv410 * @return {Command} for chaining
136 unmodified lines
547 outputHelpIfNecessary(this, unknown);548549 // If there were no args and we have unknown options,550 // then they are extraneous and we need to error.539 if (unknown.length > 0) {551 if (!this._allow_unknown && unknown.length > 0) {552 this.unknownOption(unknown[0]);553 }554 }555
444 unmodified lines