refactor: remove --time flags in favor of cargo time command (#58)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::template::{all_days, run_multi::run_multi};
|
||||
|
||||
pub fn handle(is_release: bool, is_timed: bool) {
|
||||
run_multi(&all_days().collect(), is_release, is_timed);
|
||||
pub fn handle(is_release: bool) {
|
||||
run_multi(&all_days().collect(), is_release, false);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::process::{Command, Stdio};
|
||||
|
||||
use crate::template::Day;
|
||||
|
||||
pub fn handle(day: Day, release: bool, time: bool, dhat: bool, submit_part: Option<u8>) {
|
||||
pub fn handle(day: Day, release: bool, dhat: bool, submit_part: Option<u8>) {
|
||||
let mut cmd_args = vec!["run".to_string(), "--bin".to_string(), day.to_string()];
|
||||
|
||||
if dhat {
|
||||
@@ -23,10 +23,6 @@ pub fn handle(day: Day, release: bool, time: bool, dhat: bool, submit_part: Opti
|
||||
cmd_args.push(submit_part.to_string());
|
||||
}
|
||||
|
||||
if time {
|
||||
cmd_args.push("--time".to_string());
|
||||
}
|
||||
|
||||
let mut cmd = Command::new("cargo")
|
||||
.args(&cmd_args)
|
||||
.stdout(Stdio::inherit())
|
||||
|
||||
@@ -4,12 +4,12 @@ use crate::template::run_multi::run_multi;
|
||||
use crate::template::timings::Timings;
|
||||
use crate::template::{all_days, readme_benchmarks, Day};
|
||||
|
||||
pub fn handle(day: Option<Day>, recreate_all: bool) {
|
||||
pub fn handle(day: Option<Day>, run_all: bool, store: bool) {
|
||||
let stored_timings = Timings::read_from_file();
|
||||
|
||||
let days_to_run = day.map_or_else(
|
||||
|| {
|
||||
if recreate_all {
|
||||
if run_all {
|
||||
all_days().collect()
|
||||
} else {
|
||||
// when the `--all` flag is not set, filter out days that are fully benched.
|
||||
@@ -23,16 +23,18 @@ pub fn handle(day: Option<Day>, recreate_all: bool) {
|
||||
|
||||
let timings = run_multi(&days_to_run, true, true).unwrap();
|
||||
|
||||
let merged_timings = stored_timings.merge(&timings);
|
||||
merged_timings.store_file().unwrap();
|
||||
if store {
|
||||
let merged_timings = stored_timings.merge(&timings);
|
||||
merged_timings.store_file().unwrap();
|
||||
|
||||
println!();
|
||||
match readme_benchmarks::update(merged_timings) {
|
||||
Ok(()) => {
|
||||
println!("Stored updated benchmarks.");
|
||||
}
|
||||
Err(_) => {
|
||||
eprintln!("Failed to store updated benchmarks.");
|
||||
println!();
|
||||
match readme_benchmarks::update(merged_timings) {
|
||||
Ok(()) => {
|
||||
println!("Stored updated benchmarks.");
|
||||
}
|
||||
Err(_) => {
|
||||
eprintln!("Failed to store updated benchmarks.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user