Fixed a stupid bug with by-amount and made by-weight the default

master
Wynd 2024-08-20 00:23:50 +03:00
parent f2e52f3815
commit 90bd9ac376
3 changed files with 7 additions and 7 deletions

View File

@ -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 # by default merges are counted so using --no-merges ensures they won't be counted
$ git-heatmap --no-merges $ git-heatmap --no-merges
# by default it colors every day on a per number of commits basis with --counting by-weight # by default it colors every day based on which one the maximum number of commits in a visible day
# it will color the days based on the number of commits in that day vs # shading all the others accordingly, with by-amount it will instead color each day based on
# the maximum number of commits in a day that is visible # the amount of commits in that day
$ git-heatmap --counting by-weight $ git-heatmap --counting by-amount
# filter by one or multiple authors # filter by one or multiple authors
# without an -a flag all authors will be checked # without an -a flag all authors will be checked

View File

@ -32,11 +32,11 @@ pub struct CliArgs {
#[arg(long("no-merges"), default_value_t = false)] #[arg(long("no-merges"), default_value_t = false)]
pub no_merges: bool, 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, pub counting: ColorLogic,
} }
fn get_since_date() -> String { fn get_since_date() -> String {
let date = Local::now() - Duration::days(365); let date = Local::now() - Duration::days(365);
date.format("%Y-%m-%d").to_string() date.format("%Y-%m-%d").to_string()
} }

View File

@ -109,7 +109,7 @@ fn get_color(val: i32, high: i32) -> usize {
x if x < 2 => 1, x if x < 2 => 1,
x if x < 4 => 2, x if x < 4 => 2,
x if x < 6 => 3, x if x < 6 => 3,
x if x > 6 => 4, x if x >= 6 => 4,
_ => 0, _ => 0,
}, },
ColorLogic::ByWeight => { ColorLogic::ByWeight => {