Skip to content
Myr

docs

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

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 03178dc · Browse files · 1 file+26 added−0 removed
This commit

State

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

Diff stats

1 file+26 added−0 removed

  • other:+26 added−0 removed

1 file+26 added−0 removed

modified:lib/commander.js+26 added
97 unmodified lines
9899/**100 * Add command `name`.101 *102 * The `.action()` callback is invoked when the103 * command `name` is specified via __ARGV__,104 * and the remaining arguments are applied to the105 * function for access.106 *107 * When the `name` is "*" an un-matched command108 * will be passed as the first arg, followed by109 * the rest of __ARGV__ remaining.110 *111 * Examples:112 *113 * program114 * .version('0.0.1')
63 unmodified lines
178 });179 return this;180};181182/**183 * Register callback `fn` for the command.184 *185 * Examples:186 *187 * program188 * .command('help')189 * .description('display verbose help')190 * .action(function(){191 * // output help here192 * });193 *194 * @param {Function} fn195 * @return {Command} for chaining196 * @api public197 */198199Command.prototype.action = function(fn){200 var self = this;201 this.parent.on(this.name, function(args){202 self.args.forEach(function(arg, i){
310 unmodified lines