Skip to content
Myr

Merge pull request #176 from tonylukasavage/174-1

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

Support for `--cflags` style option parameters, unit test, fixes #174

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents 38b7adb, edbcdac · Browse files · 2 files+28 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+28 added−2 removed

  • tests:+22 added−0 removed
  • other:+6 added−2 removed

2 files+28 added−2 removed

added:test/test.options.cflags.js+22 added
modified:index.js+6 added-2 removed
429 unmodified lines
430431Command.prototype.normalize = function(args){432 var ret = []433 , arg434 , lastOpt435 , index;436437 for (var i = 0, len = args.length; i < len; ++i) {438 arg = args[i];439 i > 0 && (lastOpt = this.optionFor(args[i-1]));440 441 if (lastOpt && lastOpt.required) {442 ret.push(arg);438 if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {443 } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {444 arg.slice(1).split('').forEach(function(c){445 ret.push('-' + c);446 });447 } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
100 unmodified lines
548 // requires arg549 if (option.required) {550 arg = argv[++i];551 if (null == arg) return this.optionMissingArgument(option);547 if ('-' == arg[0] && '-' != arg) return this.optionMissingArgument(option, arg);552 this.emit(option.name(), arg);553 // optional arg554 } else if (option.optional) {555 arg = argv[i+1];
296 unmodified lines