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

arg-parser

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arg-parser - npm Package Compare versions

Comparing version

to
1.1.0

9

arg-parser.js

@@ -14,3 +14,2 @@ /*global module, require, console, process, __filename */

_bold = function (msg) { return '\x1B[1m' + msg + '\x1B[22m'; },

@@ -122,8 +121,7 @@ _red = function (msg) { return '\x1B[31m' + msg + '\x1B[39m'; },

param = args.splice(0, 1)[0];
tmpV = null;
// It's a SWITCH
if (param.indexOf('-') > -1) {
if (_allSwitches.indexOf(param) === -1) { // it's not on the list
if ((/^\-\w{2,}=.+$/).test(param)) { // it's multiswith (-qVa=asd) and last param has value

@@ -140,3 +138,2 @@ args.push('-' + param.substr(param.indexOf('=') - 1)); // put the one with value back

tmpV = null;
if ((/^\-\-?\w+=.+$/).test(param)) {

@@ -148,3 +145,2 @@ tmp = param.split('=');

}
_switches.forEach(function (sw) {

@@ -161,3 +157,4 @@ if (sw.switches.indexOf(param) > -1) {

else if (args[0] && args[0].indexOf('-') !== 0) self.params[sw.name] = args.splice(0, 1)[0];
else return error = 'Incorrect syntax...';
else if (typeof sw.default !== 'undefined') self.params[sw.name] = sw.default;
else return error = 'Incorrect syntax...', error;
}

@@ -164,0 +161,0 @@ }

{
"name": "arg-parser",
"version": "1.0.1",
"version": "1.1.0",
"description": "node cli arguments parser",
"author": { "name": "Tom" },
"author": {
"name": "Tom"
},
"main": "arg-parser",
"dependencies": {},
"engines": { "node": ">=0.8.0" },
"keywords": [ "args", "parser" ],
"licenses": [ { "type": "MIT", "url": "https://raw.github.com/tborychowski/node-arg-parser/master/LICENSE" } ],
"repository": { "type": "git", "url": "https://github.com/tborychowski/node-arg-parser.git" }
"engines": {
"node": ">=0.8.0"
},
"keywords": [
"args",
"parser"
],
"licenses": [
{
"type": "MIT",
"url": "https://raw.github.com/tborychowski/node-arg-parser/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "https://github.com/tborychowski/node-arg-parser.git"
}
}

@@ -8,2 +8,7 @@ node-arg-parser

Install
-------
npm install arg-parser
Example

@@ -15,14 +20,13 @@ --------

var Args = require('arg-parser'),
var Args = require('arg-parser'),
args = new Args('ArgParserTester', '1.0', 'NodeJS arg-parser module tester',
'In addition to these parameters - more info here...');
args = new Args('ArgParserTester', '1.0', 'NodeJS arg-parser module tester',
'In addition to these parameters - more info here...');
args.add({ name: 'input', desc: 'input file', switches: [ '-i', '--input-file'], value: 'file' });
args.add({ name: 'output', desc: 'output file', switches: [ '-o', '--output-file'], value: 'file' });
args.add({ name: 'quiet', desc: 'quiet mode', switches: [ '-q', '--quiet'] });
args.add({ name: 'verbose', desc: 'verbose mode', switches: [ '-V', '--verbose'] });
args.add({ name: 'text', desc: 'text to store', required: true });
args.add({ name: 'input', desc: 'input file', switches: [ '-i', '--input-file'], value: 'file' });
args.add({ name: 'output', desc: 'output file', switches: [ '-o', '--output-file'], value: 'file' });
args.add({ name: 'quiet', desc: 'quiet mode', switches: [ '-q', '--quiet'] });
args.add({ name: 'verbose', desc: 'verbose mode', switches: [ '-V', '--verbose'] });
args.add({ name: 'text', desc: 'text to store', required: true });
if (args.parse()) console.log(args.params);
if (args.parse()) console.log(args.params);
````

@@ -29,0 +33,0 @@