[Pkg-javascript-commits] [node-optimist] 01/33: Imported Upstream version 0.3.6
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Fri Feb 27 23:21:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository node-optimist.
commit c6e54635c70e2460583154196788f7ae063813a3
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Fri Feb 27 20:00:27 2015 +0100
Imported Upstream version 0.3.6
---
.travis.yml | 4 ++--
example/reflect.js | 2 --
index.js | 5 ++++-
package.json | 9 ++-------
README.markdown => readme.markdown | 0
test/_/argv.js | 2 --
test/parse.js | 13 +++++++++++++
x.js | 1 -
8 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 895dbd3..cc4dba2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,4 @@
language: node_js
node_js:
- - 0.6
- - 0.8
+ - "0.8"
+ - "0.10"
diff --git a/example/reflect.js b/example/reflect.js
deleted file mode 100644
index 816b3e1..0000000
--- a/example/reflect.js
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-console.dir(require('optimist').argv);
diff --git a/index.js b/index.js
index e69bef9..08246ff 100644
--- a/index.js
+++ b/index.js
@@ -328,7 +328,10 @@ function Argv (args, cwd) {
break;
}
else if (arg.match(/^--.+=/)) {
- var m = arg.match(/^--([^=]+)=(.*)/);
+ // Using [\s\S] instead of . because js doesn't support the
+ // 'dotall' regex modifier. See:
+ // http://stackoverflow.com/a/1068308/13216
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
setArg(m[1], m[2]);
}
else if (arg.match(/^--no-.+/)) {
diff --git a/package.json b/package.json
index 5bac328..0c02a92 100644
--- a/package.json
+++ b/package.json
@@ -1,19 +1,14 @@
{
"name" : "optimist",
- "version" : "0.3.5",
+ "version" : "0.3.6",
"description" : "Light-weight option parsing with an argv hash. No optstrings attached.",
"main" : "./index.js",
- "directories" : {
- "lib" : ".",
- "test" : "test",
- "example" : "example"
- },
"dependencies" : {
"wordwrap" : "~0.0.2"
},
"devDependencies" : {
"hashish": "~0.0.4",
- "tap" : "~0.2.4"
+ "tap" : "~0.4.0"
},
"scripts" : {
"test" : "tap ./test/*.js"
diff --git a/README.markdown b/readme.markdown
similarity index 100%
rename from README.markdown
rename to readme.markdown
diff --git a/test/_/argv.js b/test/_/argv.js
deleted file mode 100644
index 3d09606..0000000
--- a/test/_/argv.js
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-console.log(JSON.stringify(process.argv));
diff --git a/test/parse.js b/test/parse.js
index a6ce9f1..d320f43 100644
--- a/test/parse.js
+++ b/test/parse.js
@@ -244,6 +244,19 @@ test('boolean groups', function (t) {
t.end();
});
+test('newlines in params' , function (t) {
+ var args = optimist.parse([ '-s', "X\nX" ])
+ t.same(args, { _ : [], s : "X\nX", $0 : $0 });
+
+ // reproduce in bash:
+ // VALUE="new
+ // line"
+ // node program.js --s="$VALUE"
+ args = optimist.parse([ "--s=X\nX" ])
+ t.same(args, { _ : [], s : "X\nX", $0 : $0 });
+ t.end();
+});
+
test('strings' , function (t) {
var s = optimist([ '-s', '0001234' ]).string('s').argv.s;
t.same(s, '0001234');
diff --git a/x.js b/x.js
deleted file mode 100644
index 6c006d0..0000000
--- a/x.js
+++ /dev/null
@@ -1 +0,0 @@
-console.dir(require('./').argv);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/node-optimist.git
More information about the Pkg-javascript-commits
mailing list