From 90bd9ac376a5528b49ee287a331bd7b5041b4403 Mon Sep 17 00:00:00 2001 From: Wynd Date: Tue, 20 Aug 2024 00:23:50 +0300 Subject: [PATCH] Fixed a stupid bug with by-amount and made by-weight the default --- README.md | 8 ++++---- src/cli.rs | 4 ++-- src/main.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bfb5a2d..93ea42e 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,10 @@ $ git-heatmap -r "/path/to/repo" -b "main" -r "other/repo" -b "" # by default merges are counted so using --no-merges ensures they won't be counted $ git-heatmap --no-merges -# by default it colors every day on a per number of commits basis with --counting by-weight -# it will color the days based on the number of commits in that day vs -# the maximum number of commits in a day that is visible -$ git-heatmap --counting by-weight +# by default it colors every day based on which one the maximum number of commits in a visible day +# shading all the others accordingly, with by-amount it will instead color each day based on +# the amount of commits in that day +$ git-heatmap --counting by-amount # filter by one or multiple authors # without an -a flag all authors will be checked diff --git a/src/cli.rs b/src/cli.rs index 5b6cfd1..394b5fb 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -32,11 +32,11 @@ pub struct CliArgs { #[arg(long("no-merges"), default_value_t = false)] pub no_merges: bool, - #[arg(long("counting"), value_enum, default_value_t = ColorLogic::ByAmount)] + #[arg(long("counting"), value_enum, default_value_t = ColorLogic::ByWeight)] pub counting: ColorLogic, } fn get_since_date() -> String { let date = Local::now() - Duration::days(365); date.format("%Y-%m-%d").to_string() -} +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index dc15b54..25fb3f5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,7 +109,7 @@ fn get_color(val: i32, high: i32) -> usize { x if x < 2 => 1, x if x < 4 => 2, x if x < 6 => 3, - x if x > 6 => 4, + x if x >= 6 => 4, _ => 0, }, ColorLogic::ByWeight => {