diff --git a/lib/cli.js b/lib/cli.js index 981c15f..ba87f4d 100755 --- a/lib/cli.js +++ b/lib/cli.js @@ -10,8 +10,9 @@ var options = require("nomnom") .script("jsonlint") .options({ file: { + list: true, position: 0, - help: "file to parse; otherwise uses stdin" + help: "file(s) to parse; otherwise uses stdin" }, version: { flag : true, @@ -131,12 +132,14 @@ function schemaError (str, err) { function main (args) { var source = ''; if (options.file) { - var json = path.normalize(options.file); - source = parse(fs.readFileSync(json, "utf8")); - if (options.inplace) { - fs.writeSync(fs.openSync(json,'w+'), source, 0, "utf8"); - } else { - if (! options.quiet) { console.log(source)}; + for (var i = 0; i < options.file.length; i++) { + var json = path.normalize(options.file[i]); + source = parse(fs.readFileSync(json, "utf8")); + if (options.inplace) { + fs.writeSync(fs.openSync(json,'w+'), source, 0, "utf8"); + } else { + if (! options.quiet) { console.log(source)}; + } } } else { var stdin = process.openStdin();