From 802bfecb37d2e6cd6adb8d54f68d783e05d94d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Mon, 9 Feb 2015 14:55:09 +0200 Subject: [PATCH] Prevent showing the Moment deprecation log --- bin/git-stats | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/git-stats b/bin/git-stats index 67a5326..686c03f 100755 --- a/bin/git-stats +++ b/bin/git-stats @@ -9,11 +9,10 @@ var GitStats = require("../lib") , GitStatsColors = require("git-stats-colors") ; -// Configure logger +// Configurations Logger.config.displayDate = false; Logger.config.logLevel = 4; - -// Constants +Moment.suppressDeprecationWarnings = true; // CLI options switch (process.argv[2]) { @@ -35,14 +34,12 @@ switch (process.argv[2]) { console.log(require("../package.json").version); break; default: - var options = { - start: Moment().subtract(1, "years") - , end: Moment() - }; + var options = {}; if (process.argv.length !== 2) { if (process.argv[2]) { options.start = Moment(process.argv[2]); + } if (process.argv[3]) { @@ -50,6 +47,14 @@ switch (process.argv[2]) { } } + if (!options.start || !options.start.isValid()) { + options.start = Moment().subtract(1, "years"); + } + + if (!options.end || !options.end.isValid()) { + options.end = Moment(); + } + GitStats.ansiCalendar(options, function (err, data) { if (err) { return Logger.log(err, "error"); } data = AnsiParser.removeAnsi(data);