Skip to content
Myr

fix --name clobbering. Closes #92

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

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent 1fc8330 · Browse files · 1 file+5 added−4 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−4 removed

  • other:+5 added−4 removed

1 file+5 added−4 removed

modified:lib/commander.js+5 added-4 removed
86 unmodified lines
87function Command(name) {88 this.commands = [];89 this.options = [];90 this.args = [];91 this.name = name;91 this._name = name;92}9394/**95 * Inherit from `EventEmitter.prototype`.
102 unmodified lines
198 */199200Command.prototype.action = function(fn){201 var self = this;202 this.parent.on(this.name, function(args, unknown){ 202 this.parent.on(this._name, function(args, unknown){ 203 // Parse any so-far unknown options204 unknown = unknown || [];205 var parsed = self.parseOptions(unknown);206
136 unmodified lines
343 // store raw args344 this.rawArgs = argv;345346 // guess name347 if (!this.name) this.name = basename(argv[1]);347 this._name = this._name || basename(argv[1]);348349 // process argv350 var parsed = this.parseOptions(this.normalize(argv.slice(2)));351 this.args = parsed.args;352 return this.parseArgs(this.args, parsed.unknown);
347 unmodified lines
700701Command.prototype.helpInformation = function(){702 return [703 ''703 , ' Usage: ' + this.name + ' ' + this.usage()704 , ' Usage: ' + this._name + ' ' + this.usage()705 , '' + this.commandHelp()706 , ' Options:'707 , ''708 , '' + this.optionHelp().replace(/^/gm, ' ')
357 unmodified lines