Added the authorsPie function code

This commit is contained in:
Ionică Bizău 2015-05-26 12:18:04 +03:00
parent 93abe47f1d
commit e82561ef08

View file

@ -5,6 +5,7 @@ var Ul = require("ul")
, CliBox = require("cli-box") , CliBox = require("cli-box")
, Couleurs = require("couleurs")() , Couleurs = require("couleurs")()
, Gry = require("gry") , Gry = require("gry")
, IsThere = require("is-there")
; ;
// Constants // Constants
@ -401,5 +402,19 @@ GitStats.ansiCalendar = function (data, callback) {
}; };
GitStats.authorsPie = function (options, callback) { GitStats.authorsPie = function (options, callback) {
if (typeof options === "string") {
options = {
repo: options
};
}
if (!IsThere.sync(options.repo)) {
return callback(new Error("Repository is missing."));
}
var repo = new Gry(options.repo);
repo.exec("shortlog -s -n --all", function (err, stdout) {
if (err) { return callback(err); }
console.log(stdout);
});
}; };