Skip to content
Myr

handle when action and option have same name, fixes #346

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

authored by Tony Lukasavage · committed by Tony Lukasavage · parent 6135fbc · Browse files · 2 files+19 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+19 added−4 removed

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

2 files+19 added−4 removed

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