Skip to content

Commit

Permalink
Revert "Issue #346, fix collisions when option and first arg have sam…
Browse files Browse the repository at this point in the history
…e name"
  • Loading branch information
zhiyelee committed Mar 11, 2015
1 parent 481e943 commit f9bcf37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ Command.prototype.action = function(fn) {

fn.apply(self, args);
};
this.parent.on('action_' + this._name, listener);
if (this._alias) this.parent.on('action_' + this._alias, listener);
this.parent.on(this._name, listener);
if (this._alias) this.parent.on(this._alias, listener);
return this;
};

Expand Down Expand Up @@ -568,8 +568,8 @@ Command.prototype.parseArgs = function(args, unknown) {

if (args.length) {
name = args[0];
if (this.listeners('action_' + name).length) {
this.emit('action_' + args.shift(), args, unknown);
if (this.listeners(name).length) {
this.emit(args.shift(), args, unknown);
} else {
this.emit('*', args);
}
Expand Down
14 changes: 0 additions & 14 deletions test/test.options.same-name-arg.js

This file was deleted.

0 comments on commit f9bcf37

Please sign in to comment.