Skip to content

Commit

Permalink
Merge branch 'asMarkdown' of git://github.com/ptusch/license-checker …
Browse files Browse the repository at this point in the history
…into ptusch-asMarkdown
  • Loading branch information
davglass committed Jun 29, 2015
2 parents 703ad47 + 2d9fffd commit 83a7f09
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/license-checker
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ checker.init(args, function(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);
}
Expand Down
1 change: 1 addition & 0 deletions lib/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var nopt = require('nopt'),
known = {
json: Boolean,
csv: Boolean,
markdown: Boolean,
out: require('path'),
unknown: Boolean,
version: Boolean,
Expand Down
12 changes: 12 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,15 @@ exports.asCSV = function(sorted) {

return text.join('\n');
};

exports.asMarkDown = function(sorted) {
var text = new Array();
Object.keys(sorted).forEach(function(key) {
var module = sorted[key];

var line = '[' + key + '](' + module.repository + ') - ' + module.licenses;
text.push(line);
});

return text.join('\n');
};

0 comments on commit 83a7f09

Please sign in to comment.