Permalink
Browse files

added quiet mode

  • Loading branch information...
1 parent cdb7737 commit f2e1de30395ba152abfc0e27da1dcebace6a057b @gregglind gregglind committed Aug 22, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/cli.js
View
10 lib/cli.js
@@ -48,6 +48,12 @@ var options = require("nomnom")
string: '-e, --environment',
"default": "json-schema-draft-03",
help: 'which specification of JSON Schema the validation file uses'
+ },
+ quiet: {
+ flag: true,key: "value",
+ string: '-q, --quiet',
+ "default": false,
+ help : 'do not print the parsed json to STDOUT'
}
}).parse();
@@ -100,7 +106,7 @@ function main (args) {
if (options.inplace) {
fs.writeSync(fs.openSync(path,'w+'), source, 0, "utf8");
} else {
- console.log(source);
+ if (! options.quiet) { console.log(source)};
}
} else {
var stdin = process.openStdin();
@@ -110,7 +116,7 @@ function main (args) {
source += chunk.toString('utf8');
});
stdin.on('end', function () {
- console.log(parse(source));
+ if (! options.quiet) {console.log(parse(source))};
});
}
}

0 comments on commit f2e1de3

Please sign in to comment.