mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2025-03-11 11:08:58 +01:00
Show months
This commit is contained in:
parent
7c5bb1d048
commit
2ea15d18c5
1 changed files with 14 additions and 2 deletions
16
lib/index.js
16
lib/index.js
|
@ -203,6 +203,7 @@ GitStats.ansiCalendar = function (data, callback) {
|
|||
}
|
||||
|
||||
var year = []
|
||||
, months = []
|
||||
, cWeek = [" ", " ", " ", " ", " ", " ", " "]
|
||||
, sDay = ""
|
||||
, cDayObj = null
|
||||
|
@ -215,6 +216,12 @@ GitStats.ansiCalendar = function (data, callback) {
|
|||
if (err) { return callback(err); }
|
||||
GitStats.iterateDays(function (cDay, mDay) {
|
||||
sDay = mDay.format("ddd");
|
||||
if (mDay.format("D") === "1") {
|
||||
debugger
|
||||
//months[mDay.format(DATE_FORMAT)] = mDay.format("MMM");
|
||||
months.push(mDay.format("MMM"));
|
||||
}
|
||||
|
||||
cDayObj = cal.days[cDay];
|
||||
if (!cDayObj) return;
|
||||
|
||||
|
@ -237,11 +244,14 @@ GitStats.ansiCalendar = function (data, callback) {
|
|||
strYear += "\n";
|
||||
}
|
||||
|
||||
// Add day names
|
||||
strYear = strYear.split("\n").map(function (c, i) {
|
||||
if (i > 6) { return; }
|
||||
return DAYS[i] + c;
|
||||
}).join("\n");
|
||||
|
||||
var foo = "MMM"
|
||||
strYear = foo + months.join(" ") + "\n" + strYear;
|
||||
strYear +=
|
||||
new Array(5 + 2 * Math.ceil(365 / 7)).join("-")
|
||||
+ "\n" + "Contributions in the last year: " + cal.total
|
||||
|
@ -268,8 +278,10 @@ GitStats.ansiCalendar = function (data, callback) {
|
|||
text: strYear
|
||||
, stretch: true
|
||||
, hAlign: "left"
|
||||
});
|
||||
}).toString();
|
||||
|
||||
callback(null, strYear.toString());
|
||||
strYear = strYear.replace(foo, new Array(foo.length + 1).join(" "));
|
||||
|
||||
callback(null, strYear);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue