feat: highlight 90% CI and tweak colors
This commit is contained in:
4 files changed
+24
-10
No files matched your search
Generated
+1
-1
@@ -345,7 +345,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mcps"
|
name = "mcps"
|
||||||
version = "0.2.3"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mcps"
|
name = "mcps"
|
||||||
version = "0.2.3"
|
version = "0.3.0"
|
||||||
authors = ["Stephen Waits <steve@waits.net>"]
|
authors = ["Stephen Waits <steve@waits.net>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "A command-line tool for running Monte Carlo simulations on project schedules."
|
description = "A command-line tool for running Monte Carlo simulations on project schedules."
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 165 KiB |
+22
-8
@@ -15,7 +15,7 @@ Find example project definition and schedule config files in the repository:
|
|||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let matches = Command::new("Monte Carlo Project Scheduler")
|
let matches = Command::new("Monte Carlo Project Scheduler")
|
||||||
.version("0.2.3")
|
.version("0.3.0")
|
||||||
.author("Stephen Waits <steve@waits.net>")
|
.author("Stephen Waits <steve@waits.net>")
|
||||||
.about("Runs Monte Carlo simulations on project schedules")
|
.about("Runs Monte Carlo simulations on project schedules")
|
||||||
.arg(
|
.arg(
|
||||||
@@ -188,11 +188,12 @@ fn print_ascii_cdf(data: &[Duration], title: &str, start: &NaiveDate, calendar:
|
|||||||
};
|
};
|
||||||
|
|
||||||
let color_code = match 100 - i * 5 {
|
let color_code = match 100 - i * 5 {
|
||||||
0..=50 => "\x1b[31m", // Red
|
0..=45 => "\x1b[31m", // Red
|
||||||
55..=75 => "\x1b[33m", // Orange
|
50..=65 => "\x1b[38;5;173m", // Orange
|
||||||
80..=90 => "\x1b[32m", // Green
|
70..=80 => "\x1b[33m", // Yellow
|
||||||
95..=100 => "\x1b[33m", // Orange
|
85..=95 => "\x1b[32m", // Green
|
||||||
_ => "\x1b[0m", // Default (shouldn't happen)
|
96..=100 => "\x1b[33m", // Yellow
|
||||||
|
_ => "\x1b[0m", // Default (shouldn't happen)
|
||||||
};
|
};
|
||||||
let reset_code = "\x1b[0m";
|
let reset_code = "\x1b[0m";
|
||||||
|
|
||||||
@@ -204,8 +205,20 @@ fn print_ascii_cdf(data: &[Duration], title: &str, start: &NaiveDate, calendar:
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
let trailing = match 100 - i * 5 {
|
||||||
|
95 => "◀━┓",
|
||||||
|
60 => " ┣━━━━━━━━━━━━┓",
|
||||||
|
55 => " ┃ 90% ┃",
|
||||||
|
50 => " ┃ Confidence ┃",
|
||||||
|
45 => " ┃ Interval ┃",
|
||||||
|
40 => " ┣━━━━━━━━━━━━┛",
|
||||||
|
5 => "◀━┛",
|
||||||
|
6..=94 => " ┃",
|
||||||
|
_ => "",
|
||||||
|
};
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"{}{:>4}{}│{}{}{}│{}{:5.0} days{}│{}{:5.0} days{}│{}{}{}",
|
"{}{:>4}{}│{}{}{}│{}{:5.0} days{}│{}{:5.0} days{}│{}{}{}{}",
|
||||||
color_code,
|
color_code,
|
||||||
format!("p{}", 100 - i * 5),
|
format!("p{}", 100 - i * 5),
|
||||||
reset_code,
|
reset_code,
|
||||||
@@ -220,7 +233,8 @@ fn print_ascii_cdf(data: &[Duration], title: &str, start: &NaiveDate, calendar:
|
|||||||
reset_code,
|
reset_code,
|
||||||
color_code,
|
color_code,
|
||||||
end_date,
|
end_date,
|
||||||
reset_code
|
reset_code,
|
||||||
|
trailing
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
println!("────┴────────────────────────────────────────────────────────────┴──────────┴──────────┴──────────");
|
println!("────┴────────────────────────────────────────────────────────────┴──────────┴──────────┴──────────");
|
||||||
|
|||||||
Reference in new issue
Block a user