Skip to content
Myr

Merge pull request #258 from rrthomas/args-for-top-level

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

Add ability to specify arguments syntax for top-level command

authored by Randall Koutnik · committed by Randall Koutnik · parents 6134fe4, fdc3c29 · Browse files · 2 files+44 added−2 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+44 added−2 removed

  • tests:+30 added−0 removed
  • other:+14 added−2 removed

2 files+44 added−2 removed

added:test/test.arguments.js+30 added
modified:index.js+14 added-2 removed
173 unmodified lines
174 return cmd;175};176177/**178 * Define argument syntax for the top-level command.179 *180 * @api public181 */182183Command.prototype.arguments = function (desc) {184 return this.parseExpectedArgs(desc.split(/ +/));185}186187/**188 * Add an implicit `help [cmd]` subcommand189 * which invokes `--help` for the given command.190 *191 * @api private
105 unmodified lines
297 }298299 fn.apply(self, args);300 };301 var parent = this.parent || this;302 var name = parent === this ? '*' : this._name;291 this.parent.on(this._name, listener);292 if (this._alias) this.parent.on(this._alias, listener);303 parent.on(name, listener);304 if (this._alias) parent.on(this._alias, listener);305 return this;306};307308/**
775 unmodified lines