Comparing version 1.7.2 to 1.7.3
# node-dashdash changelog | ||
## 1.7.3 | ||
- [issue #8] Fix parsing of a short option group when one of the | ||
option takes an argument. For example, consider `tail` with | ||
a `-f` boolean option and a `-n` option that takes a number | ||
argument. This should parse: | ||
tail -fn5 | ||
Before this change, that would not parse correctly. | ||
## 1.7.2 | ||
@@ -4,0 +16,0 @@ |
@@ -29,2 +29,7 @@ #!/usr/bin/env node | ||
{ | ||
names: ['b'], | ||
type: 'bool', | ||
help: 'A boolean arg', | ||
}, | ||
{ | ||
names: ['file', 'f'], | ||
@@ -31,0 +36,0 @@ type: 'string', |
@@ -435,3 +435,2 @@ /** | ||
var name = arg[j]; | ||
// debug('name: %s (val: %s)', name, val) | ||
var option = this.optionFromName[name]; | ||
@@ -454,3 +453,3 @@ if (!option) { | ||
} else if (this.optionTakesArg(option)) { | ||
break; | ||
break; | ||
} | ||
@@ -464,4 +463,4 @@ j++; | ||
var val = arg.slice(j + 1); // option val if it takes an arg | ||
var option = this.optionFromName[name]; | ||
var takesArg = this.optionTakesArg(option); | ||
var option = this.optionFromName[name]; | ||
if (!takesArg) { | ||
@@ -468,0 +467,0 @@ addOpt(option, '-'+name, option.key, true, 'argv'); |
{ | ||
"name": "dashdash", | ||
"description": "A light, featureful and explicit option parsing library.", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"author": "Trent Mick <trentm@gmail.com> (http://trentm.com)", | ||
@@ -6,0 +6,0 @@ "keywords": ["option", "parser", "parsing", "cli", "command", "args"], |
@@ -314,2 +314,56 @@ /* | ||
{ | ||
options: [ {name: 'f', type: 'string'}, | ||
{names: ['all', 'a'], type: 'bool'} ], | ||
argv: 'node tool.js -af', | ||
expect: /do not have enough args/ | ||
}, | ||
{ | ||
options: [ {name: 'f', type: 'string'}, | ||
{names: ['all', 'a'], type: 'bool'} ], | ||
argv: 'node tool.js -af foo.txt', | ||
expect: { | ||
all: true, | ||
f: 'foo.txt', | ||
_args: [] | ||
} | ||
}, | ||
{ | ||
options: [ {name: 'f', type: 'string'}, | ||
{names: ['all', 'a'], type: 'bool'} ], | ||
argv: 'node tool.js -affoo.txt', | ||
expect: { | ||
all: true, | ||
f: 'foo.txt', | ||
_args: [] | ||
} | ||
}, | ||
{ | ||
options: [ {name: 'f', type: 'string'}, | ||
{name: 'v', type: 'arrayOfBool'} ], | ||
argv: 'node tool.js -v -vvf', | ||
expect: /do not have enough args/ | ||
}, | ||
{ | ||
options: [ {name: 'f', type: 'string'}, | ||
{name: 'v', type: 'arrayOfBool'} ], | ||
argv: 'node tool.js -v -vvf foo.txt', | ||
expect: { | ||
v: [true, true, true], | ||
f: 'foo.txt', | ||
_args: [] | ||
} | ||
}, | ||
{ | ||
options: [ {name: 'f', type: 'string'}, | ||
{name: 'v', type: 'arrayOfBool'} ], | ||
argv: 'node tool.js -v -vvffoo.txt', | ||
expect: { | ||
v: [true, true, true], | ||
f: 'foo.txt', | ||
_args: [] | ||
} | ||
}, | ||
// type=number | ||
@@ -316,0 +370,0 @@ { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88509
2029