diff --git a/lib/index.js b/lib/index.js index bf6615d..2be24e4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -6,6 +6,7 @@ var Ul = require("ul") , Couleurs = require("couleurs")() , Gry = require("gry") , IsThere = require("is-there") + , CliPie = require("cli-pie") ; // Constants @@ -412,9 +413,30 @@ GitStats.authorsPie = function (options, callback) { return callback(new Error("Repository is missing.")); } - var repo = new Gry(options.repo); + var repo = new Gry(options.repo) + , pie = null + , pieData = [] + ; + repo.exec("shortlog -s -n --all", function (err, stdout) { if (err) { return callback(err); } - console.log(stdout); + lines = stdout.split("\n"); + + pieData = stdout.split("\n").map(function (c) { + var splits = c.split("\t").map(function (cc) { + return cc.trim(); + }); + return { + value: parseInt(splits[0]) + , label: splits[1] + }; + }); + + pie = new CliPie(20, pieData, { + legend: true + , flat: true + }); + + callback(null, pie.toString()); }); };