Prevent showing the Moment deprecation log

This commit is contained in:
Ionică Bizău 2015-02-09 14:55:09 +02:00
parent 50656a32ee
commit 802bfecb37

View file

@ -9,11 +9,10 @@ var GitStats = require("../lib")
, GitStatsColors = require("git-stats-colors") , GitStatsColors = require("git-stats-colors")
; ;
// Configure logger // Configurations
Logger.config.displayDate = false; Logger.config.displayDate = false;
Logger.config.logLevel = 4; Logger.config.logLevel = 4;
Moment.suppressDeprecationWarnings = true;
// Constants
// CLI options // CLI options
switch (process.argv[2]) { switch (process.argv[2]) {
@ -35,14 +34,12 @@ switch (process.argv[2]) {
console.log(require("../package.json").version); console.log(require("../package.json").version);
break; break;
default: default:
var options = { var options = {};
start: Moment().subtract(1, "years")
, end: Moment()
};
if (process.argv.length !== 2) { if (process.argv.length !== 2) {
if (process.argv[2]) { if (process.argv[2]) {
options.start = Moment(process.argv[2]); options.start = Moment(process.argv[2]);
} }
if (process.argv[3]) { 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) { GitStats.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);