Skip to content

Commit

Permalink
Add option for parseable output
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsk committed Apr 15, 2012
1 parent 196f5b3 commit 09e79ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Readme.md
Expand Up @@ -121,6 +121,7 @@ yields:
-s, --select <fn> use the given <fn> for filtering
-m, --map <fn> use the given <fn> for mapping
-c, --color color the json output
-p, --parseable make the json output machine-parseable
```
Expand Down
4 changes: 4 additions & 0 deletions bin/jog
Expand Up @@ -49,6 +49,7 @@ program
.option('-s, --select <fn>', 'use the given <fn> for filtering')
.option('-m, --map <fn>', 'use the given <fn> for mapping')
.option('-c, --color', 'color the json output')
.option('-p, --parseable', 'make the json output machine-parseable')
.parse(process.argv);

// determine store
Expand Down Expand Up @@ -120,6 +121,9 @@ stream.on('end', function(){
*/

function output(obj) {
if (program.parseable) {
console.log(JSON.stringify(obj));
} else
if (program.color) {
console.log(util.inspect(obj, false, 15, true));
} else {
Expand Down

0 comments on commit 09e79ab

Please sign in to comment.