Skip to content

Commit

Permalink
Merge pull request #26 from gregglind/quiet25
Browse files Browse the repository at this point in the history
added quiet mode #25
  • Loading branch information
zaach committed Aug 22, 2012
2 parents cdb7737 + f2e1de3 commit 5e02f8b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand All @@ -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))};
});
}
}
Expand Down

0 comments on commit 5e02f8b

Please sign in to comment.