Skip to content

Commit

Permalink
env parse example
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Apr 15, 2013
1 parent 24106f5 commit 5757c42
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions example/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var parse = require('../').parse;
var xs = parse('beep --boop="$PWD"', { PWD: '/home/robot' });
console.dir(xs);
16 changes: 15 additions & 1 deletion readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 5757c42

Please sign in to comment.