Skip to content
Myr

Merge branch 'master' of github.com:visionmedia/commander.js

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 · parents 85e9893, 03f3b6d · Browse files · 3 files+32 added−3 removed
This commit

State

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

Diff stats

3 files+32 added−3 removed

  • tests:+27 added−0 removed
  • other:+5 added−3 removed

3 files+32 added−3 removed

modified:lib/commander.js+4 added-3 removed
259 unmodified lines
260261Command.prototype.option = function(flags, description, fn, defaultValue){262 var self = this263 , option = new Option(flags, description)264 , oname = option.name()264 , name = camelcase(option.name());265 , name = camelcase(oname);266267 // default as 3rd arg268 if ('function' != typeof fn) defaultValue = fn, fn = null;269
9 unmodified lines
279 this.options.push(option);280281 // when it's passed assign the value282 // and conditionally invoke the callback282 this.on(name, function(val){283 this.on(oname, function(val){284 // coercion285 if (null != val && fn) val = fn(val);286287 // unassigned or bool
611 unmodified lines
899exports.on('help', function(){900 process.stdout.write(this.helpInformation());901 exports.emit('--help');902 process.exit(0);902});903});
added:test/test.options.camelcase.js+27 added
modified:package.json+1 added