Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dashdash

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dashdash - npm Package Compare versions

Comparing version 1.7.2 to 1.7.3

12

CHANGES.md
# 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',

5

lib/dashdash.js

@@ -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');

2

package.json
{
"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 @@ {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc