Skip to content
Myr

Merge pull request #347 from tonylukasavage/issue-346

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

Issue #346, fix collisions when option and first arg have same name

authored by Randall Koutnik · committed by Randall Koutnik · parents 2120cb1, 98a390b · Browse files · 2 files+18 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

2 files+18 added−4 removed

  • tests:+14 added−0 removed
  • other:+4 added−4 removed

2 files+18 added−4 removed

added:test/test.options.same-name-arg.js+14 added
modified:index.js+4 added-4 removed
285 unmodified lines
286 }287288 fn.apply(self, args);289 };290 this.parent.on(this._name, listener);291 if (this._alias) this.parent.on(this._alias, listener);290 this.parent.on('action_' + this._name, listener);291 if (this._alias) this.parent.on('action_' + this._alias, listener);292 return this;293};294295/**
267 unmodified lines
563 var name;564565 if (args.length) {566 name = args[0];567 if (this.listeners(name).length) {568 this.emit(args.shift(), args, unknown);567 if (this.listeners('action_' + name).length) {568 this.emit('action_' + args.shift(), args, unknown);569 } else {570 this.emit('*', args);571 }572 } else {
475 unmodified lines