Skip to content

Commit

Permalink
Re-add command:* handler
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph committed Dec 7, 2019
1 parent 37c1754 commit 1651954
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Expand Up @@ -360,8 +360,13 @@ Command.prototype.action = function(fn) {
fn.apply(self, actionArgs);
};
var parent = this.parent || this;
var name = parent === this ? 'program-action' : 'command:' + this._name;
parent.on(name, listener);
if (parent === this) {
// Only one of these can ever be triggered, but we don't know which
parent.on('program-action', listener)
parent.on('command:*', listener)
} else {
parent.on('command:' + this._name, listener)
}

if (this._alias) parent.on('command:' + this._alias, listener);
return this;
Expand Down

0 comments on commit 1651954

Please sign in to comment.