[Pkg-javascript-commits] [node-shell-quote] 33/137: env parse example
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Aug 25 19:19:37 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-shell-quote.
commit 5757c4256a4cbaeaabd3d8cd91c7e19109329067
Author: James Halliday <mail at substack.net>
Date: Sun Apr 14 21:32:24 2013 -0700
env parse example
---
example/env.js | 3 +++
readme.markdown | 16 +++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/example/env.js b/example/env.js
new file mode 100644
index 0000000..3608a58
--- /dev/null
+++ b/example/env.js
@@ -0,0 +1,3 @@
+var parse = require('../').parse;
+var xs = parse('beep --boop="$PWD"', { PWD: '/home/robot' });
+console.dir(xs);
diff --git a/readme.markdown b/readme.markdown
index 1b9a334..01af175 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -22,7 +22,7 @@ a 'b c d' \$f '"g"'
## parse
-``` js`
+``` js
var parse = require('shell-quote').parse;
var xs = parse('a "b c" \\$def \'it\\\'s great\'');
console.dir(xs);
@@ -34,6 +34,20 @@ output
[ 'a', 'b c', '\\$def', 'it\'s great' ]
```
+## parse with an environment variable
+
+``` js
+var parse = require('shell-quote').parse;
+var xs = parse('beep --boop="$PWD"', { PWD: '/home/robot' });
+console.dir(xs);
+```
+
+output
+
+```
+[ 'beep', '--boop=/home/robot' ]
+```
+
# methods
``` js
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-shell-quote.git
More information about the Pkg-javascript-commits
mailing list