mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-12-22 13:22:11 +01:00
Added the authorsPie function code
This commit is contained in:
parent
93abe47f1d
commit
e82561ef08
1 changed files with 15 additions and 0 deletions
17
lib/index.js
17
lib/index.js
|
@ -5,6 +5,7 @@ var Ul = require("ul")
|
|||
, CliBox = require("cli-box")
|
||||
, Couleurs = require("couleurs")()
|
||||
, Gry = require("gry")
|
||||
, IsThere = require("is-there")
|
||||
;
|
||||
|
||||
// Constants
|
||||
|
@ -401,5 +402,19 @@ GitStats.ansiCalendar = function (data, 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);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue