diff --git a/bin/git-stats b/bin/git-stats index 24ed978..65c3e07 100755 --- a/bin/git-stats +++ b/bin/git-stats @@ -20,6 +20,7 @@ Moment.suppressDeprecationWarnings = true; var recordOpt = new CLP.Option(["record"], "Records a new commit. Don't use this unless you are a mad scientist. If you are a developer, just use this option as part of the module.", "data") , startDateOpt = new CLP.Option(["s", "start"], "Optional start date", "date") , endDateOpt = new CLP.Option(["e", "end"], "Optional end date", "date") + , authorsOpt = new CLP.Option(["a", "authors"], "Shows a pie chart with the author related contributions in the current repository.") , noAnsiOpt = new CLP.Option(["n", "no-ansi"], "Forces the tool not to use ANSI styles.") , lightOpt = new CLP.Option(["l", "light"], "Enables the light theme.") , parser = new CLP({ @@ -79,12 +80,13 @@ if (!options.end || !options.end.isValid()) { Logger.log("Invalid end date. Using default instead (" + options.end.format("LL") + ").", "warn"); } -// Create the ANSI calendar -GitStats.ansiCalendar(options, function (err, data) { +// Show the graphs +GitStats[authorsOpt.is_provided ? "authorsPie" : "ansiCalendar"](options, function (err, data) { if (err) { return Logger.log(err, "error"); } data = AnsiParser.removeAnsi(data); if (!noAnsiOpt.is_provided) { data = GitStatsColors(data, lightOpt.is_provided ? "LIGHT": "DARK"); } process.stdout.write(data + "\n"); + }); diff --git a/lib/index.js b/lib/index.js index beb9a01..c631845 100644 --- a/lib/index.js +++ b/lib/index.js @@ -398,3 +398,7 @@ GitStats.ansiCalendar = function (data, callback) { return GitStats; }; + +GitStats.authorsPie = function (options, callback) { + +};