[Pkg-javascript-commits] [node-shell-quote] 07/137: readme with examples
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Aug 25 19:19:34 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 6373c0f56de87702a61063ffae354e2bb989de91
Author: James Halliday <mail at substack.net>
Date: Fri May 18 03:39:54 2012 -0700
readme with examples
---
README.markdown | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
example/parse.js | 3 +++
example/quote.js | 3 +++
3 files changed, 76 insertions(+)
diff --git a/README.markdown b/README.markdown
new file mode 100644
index 0000000..b5e8f41
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,70 @@
+shell-quote
+===========
+
+Parse and quote shell commands.
+
+example
+=======
+
+quote
+-----
+
+``` js
+var quote = require('shell-quote').quote;
+var s = quote([ 'a', 'b c d', '$f', '"g"' ]);
+console.log(s);
+```
+
+output
+
+```
+a 'b c d' \$f '"g"'
+```
+
+parse
+-----
+
+``` js`
+var parse = require('shell-quote').parse;
+var xs = parse('a "b c" \\$def \'it\\\'s great\'');
+console.dir(xs);
+```
+
+output
+
+```
+[ 'a', 'b c', '\\$def', 'it\'s great' ]
+```
+
+methods
+=======
+
+``` js
+var quote = require('shell-quote').quote;
+var parse = require('shell-quote').parse;
+```
+
+quote(args)
+-----------
+
+Return a quoted string for the array `args` suitable for using in shell
+commands.
+
+parse(cmd)
+----------
+
+Return an array of arguments from the quoted string `cmd`.
+
+install
+=======
+
+With [npm](http://npmjs.org) do:
+
+```
+npm install shell-quote
+```
+
+license
+=======
+
+MIT
diff --git a/example/parse.js b/example/parse.js
new file mode 100644
index 0000000..4b3be5f
--- /dev/null
+++ b/example/parse.js
@@ -0,0 +1,3 @@
+var parse = require('../').parse;
+var xs = parse('a "b c" \\$def \'it\\\'s great\'');
+console.dir(xs);
diff --git a/example/quote.js b/example/quote.js
new file mode 100644
index 0000000..434bf8a
--- /dev/null
+++ b/example/quote.js
@@ -0,0 +1,3 @@
+var quote = require('../').quote;
+var s = quote([ 'a', 'b c d', '$f', '"g"' ]);
+console.log(s);
--
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