mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-12-22 13:22:11 +01:00
Prevent showing the Moment deprecation log
This commit is contained in:
parent
50656a32ee
commit
802bfecb37
1 changed files with 12 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue