Skip to content
Browse files

Add option for parseable output

  • Loading branch information...
1 parent 196f5b3 commit 09e79abab70d9b0ed69bd5095c0791e1435912a4 @hughsk committed Apr 15, 2012
Showing with 5 additions and 0 deletions.
  1. +1 −0 Readme.md
  2. +4 −0 bin/jog
View
1 Readme.md
@@ -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
```
View
4 bin/jog
@@ -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
@@ -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 {

0 comments on commit 09e79ab

Please sign in to comment.
Something went wrong with that request. Please try again.