Pie draft

This commit is contained in:
Ionică Bizău 2015-05-05 16:56:26 +03:00
parent 08149a1c15
commit 1b6f8bab72
2 changed files with 8 additions and 2 deletions

View file

@ -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") 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") , startDateOpt = new CLP.Option(["s", "start"], "Optional start date", "date")
, endDateOpt = new CLP.Option(["e", "end"], "Optional end 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.") , 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.") , lightOpt = new CLP.Option(["l", "light"], "Enables the light theme.")
, parser = new CLP({ , 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"); Logger.log("Invalid end date. Using default instead (" + options.end.format("LL") + ").", "warn");
} }
// Create the ANSI calendar // Show the graphs
GitStats.ansiCalendar(options, function (err, data) { GitStats[authorsOpt.is_provided ? "authorsPie" : "ansiCalendar"](options, function (err, data) {
if (err) { return Logger.log(err, "error"); } if (err) { return Logger.log(err, "error"); }
data = AnsiParser.removeAnsi(data); data = AnsiParser.removeAnsi(data);
if (!noAnsiOpt.is_provided) { if (!noAnsiOpt.is_provided) {
data = GitStatsColors(data, lightOpt.is_provided ? "LIGHT": "DARK"); data = GitStatsColors(data, lightOpt.is_provided ? "LIGHT": "DARK");
} }
process.stdout.write(data + "\n"); process.stdout.write(data + "\n");
}); });

View file

@ -398,3 +398,7 @@ GitStats.ansiCalendar = function (data, callback) {
return GitStats; return GitStats;
}; };
GitStats.authorsPie = function (options, callback) {
};