add --no-readme
flag to time command
This commit is contained in:
parent
c82e1e2c08
commit
cfafda81d8
3 changed files with 25 additions and 14 deletions
|
@ -126,6 +126,8 @@ By default, this command checks for missing benchmarks, runs those solutions, an
|
|||
|
||||
Please note that these are not _scientific_ benchmarks, understand them as a fun approximation. 😉 Timings, especially in the microseconds range, might change a bit between invocations.
|
||||
|
||||
To compute the times but not update the benchmarks table in the readme, use the `--no-readme` flag.
|
||||
|
||||
### ➡️ Run all tests
|
||||
|
||||
```sh
|
||||
|
@ -156,9 +158,9 @@ cargo read <day>
|
|||
|
||||
During december, the `today` shorthand command can be used to:
|
||||
|
||||
- scaffold a solution for the current day
|
||||
- download its input
|
||||
- and read the puzzle
|
||||
- scaffold a solution for the current day
|
||||
- download its input
|
||||
- and read the puzzle
|
||||
|
||||
in one go.
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ mod args {
|
|||
},
|
||||
Time {
|
||||
all: bool,
|
||||
no_readme: bool,
|
||||
day: Option<Day>,
|
||||
},
|
||||
#[cfg(feature = "today")]
|
||||
|
@ -50,9 +51,11 @@ mod args {
|
|||
},
|
||||
Some("time") => {
|
||||
let all = args.contains("--all");
|
||||
let no_readme = args.contains("--no-readme");
|
||||
|
||||
AppArguments::Time {
|
||||
all,
|
||||
no_readme,
|
||||
day: args.opt_free_from_str()?,
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +105,11 @@ fn main() {
|
|||
}
|
||||
Ok(args) => match args {
|
||||
AppArguments::All { release, time } => all::handle(release, time),
|
||||
AppArguments::Time { day, all } => time::handle(day, all),
|
||||
AppArguments::Time {
|
||||
day,
|
||||
all,
|
||||
no_readme,
|
||||
} => time::handle(day, all, !no_readme),
|
||||
AppArguments::Download { day } => download::handle(day),
|
||||
AppArguments::Read { day } => read::handle(day),
|
||||
AppArguments::Scaffold { day, download } => {
|
||||
|
|
|
@ -4,7 +4,7 @@ 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>, recreate_all: bool, update_readme: bool) {
|
||||
let stored_timings = Timings::read_from_file();
|
||||
|
||||
let days_to_run = day.map_or_else(
|
||||
|
@ -26,6 +26,7 @@ pub fn handle(day: Option<Day>, recreate_all: bool) {
|
|||
let merged_timings = stored_timings.merge(&timings);
|
||||
merged_timings.store_file().unwrap();
|
||||
|
||||
if update_readme {
|
||||
println!();
|
||||
match readme_benchmarks::update(merged_timings) {
|
||||
Ok(()) => {
|
||||
|
@ -35,4 +36,5 @@ pub fn handle(day: Option<Day>, recreate_all: bool) {
|
|||
eprintln!("Failed to store updated benchmarks.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue