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 413c9ca, 2024eb5 · Browse files · 2 files+22 added−1 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+22 added−1 removed

  • tests:+17 added−0 removed
  • other:+5 added−1 removed

2 files+22 added−1 removed

modified:lib/commander.js+5 added-1 removed
357 unmodified lines
358359/**360 * Normalize `args`, splitting joined short flags. For example361 * the arg "-abc" is equivalent to "-a -b -c".362 * This also normalizes equal sign and splits "--abc=def" into "--abc def".363 *364 * @param {Array} args365 * @return {Array}366 * @api private367 */368369Command.prototype.normalize = function(args){370 var ret = []370 , arg;371 , arg372 , index;373374 for (var i = 0, len = args.length; i < len; ++i) {375 arg = args[i];376 if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {377 arg.slice(1).split('').forEach(function(c){378 ret.push('-' + c);379 });380 } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {381 ret.push(arg.slice(0, index), arg.slice(index + 1));382 } else {383 ret.push(arg);384 }385 }
653 unmodified lines
added:test/test.options.equals.js+17 added