Skip to content

Commit

Permalink
Always print to stdout, don't write files.
Browse files Browse the repository at this point in the history
Allows usage in a pipeline.
  • Loading branch information
timoxley committed Dec 4, 2014
1 parent b725080 commit 47bffc9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
20 changes: 4 additions & 16 deletions bin/license-checker
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,8 @@ var path = require('path');
var fs = require('fs');

checker.init(args, function(json) {
var dir;
if (args.json) {
dir = path.dirname(args.json);
mkdirp.sync(dir);
fs.writeFileSync(args.json, JSON.stringify(json, null, 4) + '\n', 'utf8');
console.log('file written', args.json);
}
else if (args.csv) {
dir = path.dirname(args.csv);
mkdirp.sync(dir);
fs.writeFileSync(args.csv, checker.asCSV(json), 'utf8');
console.log('file written', args.csv);
}
else {
checker.print(json);
}
if (args.json) return console.log(JSON.stringify(json, null, 2))
if (args.csv) return console.log(checker.asCSV(json))

checker.print(json);
});
4 changes: 2 additions & 2 deletions lib/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ http://yuilibrary.com/license/
var nopt = require('nopt'),
chalk = require('chalk'),
known = {
json: require('path'),
csv: require('path'),
json: Boolean,
csv: Boolean,
unknown: Boolean,
version: Boolean,
color: Boolean,
Expand Down

0 comments on commit 47bffc9

Please sign in to comment.