You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

cli-argparse

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-argparse - npm Package Compare versions

Comparing version

to
0.3.13

5

index.js

@@ -137,4 +137,2 @@ var short = '-', long = '--';

if(stop instanceof RegExp) {
//arg = arg.replace(stop, '');
//if(arg === '') arg = undefined;
stop = arg.replace(stop, '');

@@ -147,2 +145,5 @@ out.skip = stop ? [stop] : [];

out.unparsed = out.unparsed.concat(out.skip);
if(arg === out.raw[0]) {
out.empty = true;
}
break;

@@ -149,0 +150,0 @@ }else if(opt || ~equals || lre.test(arg)) {

2

package.json
{
"name": "cli-argparse",
"version": "0.3.12",
"version": "0.3.13",
"description": "Lightweight argument parser",

@@ -5,0 +5,0 @@ "author": "muji <noop@xpm.io>",

@@ -101,2 +101,13 @@ # Parse

#### Options
* `alias`: Map of argument names to property names.
* `flags`: Array of argument names to be treated as flags.
* `options`: Array of argument names to be treated as options.
* `strict`: A boolean that indicates only arguments specified as `options` or `flags` should be parsed.
* `flat`: A boolean that creates a flat result structure.
* `stop`: Array of strings or patterns to stop parsing on, the special pattern `--` is always respected first.
Note that you should **not** use the negated long form (--no-highlight) when specifying these hints, always use the positive form.
#### Result

@@ -111,15 +122,10 @@

* `unparsed`: Array of values that were not parsed.
* `skip`: Array of args skipped upon `--` or a custom stop pattern.
* `stop`: If a stop pattern matched this will contain the pattern that matched (string or regexp).
* `empty`: Set to `true` if a stop pattern matched on the first argument.
#### Options
##### Aliases
* `alias`: Map of argument names to property names.
* `flags`: Array of argument names to be treated as flags.
* `options`: Array of argument names to be treated as options.
* `strict`: A boolean that indicates only arguments specified as `options` or `flags` should be parsed.
* `flat`: A boolean that creates a flat result structure.
Aliases allow arguments to map to meaningful property names that will be set on the result object `options` and `flags`.
Note that you should **not** use the negated long form (--no-highlight) when specifying these hints, always use the positive form.
##### Aliases
Aliases are mapped on the raw argument name, to map `-v | --verbose` to a `verbose` property use `{'-v --verbose': 'verbose'}`.

@@ -126,0 +132,0 @@

@@ -89,2 +89,10 @@ var expect = require('chai').expect;

});
it('should set noop on stop at arg zero', function(done) {
var args = ['--', 'server', '--port=80', '--host=localhost'];
var result = parse(args, {stop: [false]});
expect(result.stop).to.eql('--');
expect(result.empty).to.eql(true);
done();
});
})
SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.