Comparing version 0.1.5 to 0.1.6
@@ -18,6 +18,10 @@ /*jslint node: true, nomen: true, vars: true, plusplus: true*/ | ||
arg = argv[i]; | ||
var parts = arg.match(/(.+)=(.+)/); | ||
var parts = arg.match(/(.+[^\\])=(.+)/); | ||
if (parts) { | ||
argv.splice(i, 1, parts[1], parts[2]); | ||
argv.splice(i, 1, parts[1], parts[2]); | ||
} | ||
if(arg.match(/\\=/)){ | ||
argv.splice(i, 1, arg.replace(/\\=/g, '=')); | ||
} | ||
} | ||
@@ -24,0 +28,0 @@ |
{ | ||
"name": "stdio", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Module for standard input/output management with NodeJS", | ||
@@ -5,0 +5,0 @@ "keywords": ["input", "console", "output", "terminal", "system"], |
@@ -7,2 +7,4 @@ Module for input/output management with nodejs. | ||
[![NPM](https://nodei.co/npm/stdio.png)](https://nodei.co/npm/stdio/) | ||
## 1. Installation | ||
@@ -57,2 +59,3 @@ | ||
As you can see, every option in `ops` object can has 3 different type of values: | ||
* The boolean value `true` if it has been specified without an `args` attribute. | ||
@@ -129,2 +132,13 @@ * A single `string` if it has been specified with `args: 1`. | ||
### 0.1.6 | ||
* Arguments now can have "=" sign escaped: `node program.js -m loc.ark+\\=13960\\=t0000693r.meta.json` will give the following: | ||
```` | ||
{ | ||
createHelp: [Function], | ||
printHelp: [Function], | ||
meta: 'loc.ark+=13960=t0000693r.meta.json' | ||
} | ||
```` | ||
### 0.1.5 | ||
@@ -164,3 +178,7 @@ | ||
* frejus: https://npmjs.org/package/frejus | ||
* cli-mirror: https://www.npmjs.org/package/cli_mirror | ||
* parser-energymech: https://www.npmjs.org/package/parser-energymech | ||
* tool-twist: https://www.npmjs.org/package/tooltwist | ||
* vtools-cli: https://www.npmjs.org/package/vtools-cli | ||
If you use this module in your project, please, let us know. |
@@ -5,11 +5,6 @@ 'use strict'; | ||
var opt = stdio.getopt({ | ||
meta: {key: 'm', args: 1} | ||
}); | ||
stdio.question('What is your name?', function (err, name) { | ||
stdio.question('Are you male?', ['y', 'n'], function (err, answer) { | ||
var male = (answer === 'y'); | ||
console.log('Name: %s\nSex: %s', name, (male ? 'male' : 'female')); | ||
}); | ||
}); | ||
console.log(opt); |
@@ -149,2 +149,16 @@ /*jslint node: true, nomen: true*/ | ||
}, | ||
{ | ||
opsSpecification: { | ||
url: {key: 'u', args: 1} | ||
}, | ||
argv: ['node', 'program.js', '--url', '"http://www.example.com/?b\\=1"'], | ||
expectedOps: {url: '"http://www.example.com/?b=1"' } | ||
}, | ||
{ | ||
opsSpecification: { | ||
meta: {key: 'm', args: 1} | ||
}, | ||
argv: ['node', 'program.js', '-m', 'loc.ark+\\=13960\\=t0000693r.meta.json'], | ||
expectedOps: {meta: 'loc.ark+=13960=t0000693r.meta.json' } | ||
} | ||
]; | ||
@@ -151,0 +165,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
2920401
438
181