Skip to content
Myr

Merge with conflicts

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

authored by John Gee · committed by John Gee · parents 1b2b950, ec38c8e · Browse files · 2 files+34 added−6 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+34 added−6 removed

  • tests:+18 added−0 removed
  • other:+16 added−6 removed

2 files+34 added−6 removed

added:test/test.options.short.adjacent-value.js+18 added
modified:index.js+16 added-6 removed
468 unmodified lines
469 argv.push('--help');470 }471472 // process argv473 var parsed = this.parseOptions(this.normalize(argv.slice(2)));473 var normalized = this.normalize(argv.slice(2));474 var parsed = this.parseOptions(normalized);475 var args = this.args = parsed.args;476477 var result = this.parseArgs(this.args, parsed.unknown);478
128 unmodified lines
607Command.prototype.normalize = function(args) {608 var ret = [],609 arg,610 lastOpt,610 index;611 index,612 short,613 opt;614615 for (var i = 0, len = args.length; i < len; ++i) {616 arg = args[i];617 if (i > 0) {
5 unmodified lines
623 ret = ret.concat(args.slice(i));624 break;625 } else if (lastOpt && lastOpt.required) {626 ret.push(arg);627 } else if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') {628 short = arg.slice(0, 2);629 opt = this.optionFor(short);630 if (opt && (opt.required || opt.optional)) {631 ret.push(short);632 ret.push(arg.slice(2));624 } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {625 arg.slice(1).split('').forEach(function(c) {626 ret.push('-' + c);627 });633 } else {634 arg.slice(1).split('').forEach(function(c) {635 ret.push('-' + c);636 });637 }638 } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {639 ret.push(arg.slice(0, index), arg.slice(index + 1));640 } else {641 ret.push(arg);
602 unmodified lines