From 4433dd11dad399db9b5ac6864b29a92fc7e31dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Wed, 8 Jul 2015 11:00:32 +0300 Subject: [PATCH] Added the global activyt option --- bin/git-stats | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/bin/git-stats b/bin/git-stats index 9ec33e5..7524ba9 100755 --- a/bin/git-stats +++ b/bin/git-stats @@ -20,6 +20,7 @@ var recordOpt = new CLP.Option(["record"], "Records a new commit. Don't use this , 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.") + , globalActivityOpt = new CLP.Option(["g", "global-activyt"], "Shows global activity calendar in the current repository.") , parser = new CLP({ name: "Git Stats" , version: Package.version @@ -40,6 +41,7 @@ var recordOpt = new CLP.Option(["record"], "Records a new commit. Don't use this , lightOpt , recordOpt , authorsOpt + , globalActivityOpt ]) , options = null ; @@ -78,8 +80,11 @@ if (!options.end || !options.end.isValid()) { Logger.log("Invalid end date. Using default instead (" + options.end.format("LL") + ").", "warn"); } -if (authorsOpt.is_provided) { +if (authorsOpt.is_provided || globalActivityOpt.is_provided) { options.repo = process.cwd(); +} + +if (authorsOpt.is_provided) { options.no_ansi = noAnsiOpt.is_provided; options.radius = (process.stdout.rows / 2) - 4; } else { @@ -88,8 +93,14 @@ if (authorsOpt.is_provided) { ; } -// Show the graphs -GitStats[authorsOpt.is_provided ? "authorsPie" : "ansiCalendar"](options, function (err, data) { +function display (err, data) { if (err) { return Logger.log(err, "error"); } process.stdout.write(data + "\n"); -}); +} + +if (globalActivityOpt.is_provided) { + return GitStats.globalActivity(options, display); +} + +// Show the graphs +GitStats[authorsOpt.is_provided ? "authorsPie" : "ansiCalendar"](options, display);