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

argparse

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

argparse - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

6

CHANGELOG.md

@@ -0,1 +1,7 @@

1.0.7 / 2016-03-17
------------------
- Teach `addArgument` to accept string arg names. #97, @tomxtobin.
1.0.6 / 2016-02-06

@@ -2,0 +8,0 @@ ------------------

12

lib/action_container.js

@@ -168,8 +168,9 @@ /** internal

* ActionContainer#addArgument(args, options) -> Object
* - args (Array): array of argument keys
* - args (String|Array): argument key, or array of argument keys
* - options (Object): action objects see [[Action.new]]
*
* #### Examples
* - addArgument([-f, --foo], {action:'store', defaultValue=1, ...})
* - addArgument(['bar'], action: 'store', nargs:1, ...})
* - addArgument([ '-f', '--foo' ], { action: 'store', defaultValue: 1, ... })
* - addArgument([ 'bar' ], { action: 'store', nargs: 1, ... })
* - addArgument('--baz', { action: 'store', nargs: 1, ... })
**/

@@ -180,4 +181,7 @@ ActionContainer.prototype.addArgument = function (args, options) {

if (typeof args === 'string') {
args = [ args ];
}
if (!Array.isArray(args)) {
throw new TypeError('addArgument first argument should be an array');
throw new TypeError('addArgument first argument should be a string or an array');
}

@@ -184,0 +188,0 @@ if (typeof options !== 'object' || Array.isArray(options)) {

{
"name": "argparse",
"description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library",
"version": "1.0.6",
"version": "1.0.7",
"keywords": [

@@ -6,0 +6,0 @@ "cli",

@@ -45,2 +45,8 @@ argparse

);
parser.addArgument(
'--baz',
{
help: 'baz bar'
}
);
var args = parser.parseArgs();

@@ -54,3 +60,3 @@ console.dir(args);

$ ./test.js -h
usage: example.js [-h] [-v] [-f FOO] [-b BAR]
usage: example.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ]

@@ -64,2 +70,3 @@ Argparse example

-b BAR, --bar BAR bar foo
--baz BAZ baz bar
```

@@ -70,4 +77,4 @@

```
$ ./test.js -f=3 --bar=4
{ foo: '3', bar: '4' }
$ ./test.js -f=3 --bar=4 --baz 5
{ foo: '3', bar: '4', baz: '5' }
```

@@ -112,3 +119,3 @@

```
ArgumentParser.addArgument([names or flags], {options})
ArgumentParser.addArgument(name or flag or [name] or [flags...], {options})
```

@@ -118,3 +125,6 @@

- ```name or flags``` - Either a name or a list of option strings, e.g. foo or -f, --foo.
- ```name or flag or [name] or [flags...]``` - Either a positional name
(e.g., `'foo'`), a single option (e.g., `'-f'` or `'--foo'`), an array
of a single positional name (e.g., `['foo']`), or an array of options
(e.g., `['-f', '--foo']`).

@@ -121,0 +131,0 @@ Options:

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