Added total number of authors string for the visible commits

master
Wynd 2024-08-17 17:02:31 +03:00
parent 25d6b47e15
commit 9e54cdb8ac
1 changed files with 5 additions and 2 deletions

View File

@ -2,6 +2,7 @@ use std::{collections::BTreeMap, fmt::Display};
use chrono::{Datelike, Duration, NaiveDate}; use chrono::{Datelike, Duration, NaiveDate};
use clap::ValueEnum; use clap::ValueEnum;
use itertools::Itertools;
use crate::{get_char, get_color, get_color_map, Commit, DAYS, RESET}; use crate::{get_char, get_color, get_color_map, Commit, DAYS, RESET};
@ -97,10 +98,12 @@ impl Display for Heatmap {
let start_date = self.since.format("%Y-%b-%d").to_string(); let start_date = self.since.format("%Y-%b-%d").to_string();
let end_date = self.until.format("%Y-%b-%d").to_string(); let end_date = self.until.format("%Y-%b-%d").to_string();
let commits = self.commits.len().to_string(); let commits = self.commits.len().to_string();
let authors = self.commits.iter().unique_by(|c| &c.author.name).count();
write!(f, "{} - {}\n", start_date, end_date).unwrap(); write!(f, "{} - {}\n", start_date, end_date).unwrap();
write!(f, "{} repos\n", self.repos).unwrap(); write!(f, "{} repo(s)\n", self.repos).unwrap();
write!(f, "{} commits\n\n", commits).unwrap(); write!(f, "{} author(s)\n", authors).unwrap();
write!(f, "{} commit(s)\n\n", commits).unwrap();
write!(f, "{}\n", self.months_row()).unwrap(); write!(f, "{}\n", self.months_row()).unwrap();
for (day, row) in DAYS.iter().zip(&self.data) { for (day, row) in DAYS.iter().zip(&self.data) {