Skip to content
Myr

Merge pull request #11 from chumpalump/chumpalump

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

Chumpalump

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents f7242dc, 51262de · Browse files · 2 files+31 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

2 files+31 added−3 removed

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

2 files+31 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
7 unmodified lines
277 this.options.push(option);278279 // when it's passed assign the value280 // and conditionally invoke the callback280 this.on(name, function(val){281 this.on(oname, function(val){282 // coercion283 if (null != val && fn) val = fn(val);284285 // assign value
604 unmodified lines
890exports.on('help', function(){891 process.stdout.write(this.helpInformation());892 exports.emit('--help');893 process.exit(0);893});894});
added:test/test.options.camelcase.js+27 added