Skip to content

Commit

Permalink
Fix json, csv and markdown output for license-checker
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattias Amnefelt committed Sep 28, 2015
1 parent c918314 commit e314a6d
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions bin/license-checker
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,16 @@ checker.init(args, function(json, err) {
} else if (args.markdown){
formattedOutput = checker.asMarkDown(json, args.customFormat);
} else {
if (args.json) {
formattedOutput = JSON.stringify(json, null, 2);
} else if (args.csv) {
formattedOutput = checker.asCSV(json);
} else if (args.markdown){
formattedOutput = checker.asMarkDown(json);
} else {
formattedOutput = checker.asTree(json);
}

if (args.out) {
var dir = path.dirname(args.out);
mkdirp.sync(dir);
//Remove the color tags
formattedOutput = chalk.stripColor(formattedOutput);
fs.writeFileSync(args.out, formattedOutput, 'utf8');
} else {
console.log(formattedOutput);
}
formattedOutput = checker.asTree(json);
}

if (args.out) {
var dir = path.dirname(args.out);
mkdirp.sync(dir);
//Remove the color tags
formattedOutput = chalk.stripColor(formattedOutput);
fs.writeFileSync(args.out, formattedOutput, 'utf8');
} else {
console.log(formattedOutput);
}
});

0 comments on commit e314a6d

Please sign in to comment.