-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Halliday
committed
May 18, 2012
1 parent
bc27efa
commit 6373c0f
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parse = require('../').parse; | ||
var xs = parse('a "b c" \\$def \'it\\\'s great\''); | ||
console.dir(xs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var quote = require('../').quote; | ||
var s = quote([ 'a', 'b c d', '$f', '"g"' ]); | ||
console.log(s); |