From 9e54cdb8aca2e230e55e94065c4a120f9d2b318e Mon Sep 17 00:00:00 2001 From: Wynd Date: Sat, 17 Aug 2024 17:02:31 +0300 Subject: [PATCH] Added total number of authors string for the visible commits --- src/heatmap.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/heatmap.rs b/src/heatmap.rs index f2bac05..f177933 100644 --- a/src/heatmap.rs +++ b/src/heatmap.rs @@ -2,6 +2,7 @@ use std::{collections::BTreeMap, fmt::Display}; use chrono::{Datelike, Duration, NaiveDate}; use clap::ValueEnum; +use itertools::Itertools; 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 end_date = self.until.format("%Y-%b-%d").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, "{} repos\n", self.repos).unwrap(); - write!(f, "{} commits\n\n", commits).unwrap(); + write!(f, "{} repo(s)\n", self.repos).unwrap(); + write!(f, "{} author(s)\n", authors).unwrap(); + write!(f, "{} commit(s)\n\n", commits).unwrap(); write!(f, "{}\n", self.months_row()).unwrap(); for (day, row) in DAYS.iter().zip(&self.data) {