From bd97e34f66e44b51c838954954b1deecbe63760d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sp=C3=B6ttel?= <1682504+fspoettel@users.noreply.github.com> Date: Tue, 18 Oct 2022 11:26:56 +0200 Subject: [PATCH] feat: add shorthands for running solutions --- .cargo/config | 4 +++- README.md | 10 +++++----- src/bin/scaffold.rs | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.cargo/config b/.cargo/config index abaea5b..7d217dc 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,4 +1,6 @@ [alias] -rr = "run --release" scaffold = "run --bin scaffold -- " download = "run --bin download -- " + +day = "run --bin" +all = "run" diff --git a/README.md b/README.md index d416666..0a8504e 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,8 @@ Puzzle inputs are not checked into git. [Reasoning](https://old.reddit.com/r/adv ### Run solutions for a day ```sh -# example: `cargo run --bin 01` -cargo run --bin +# example: `cargo day 01` +cargo day # output: # Running `target/debug/01` @@ -86,14 +86,14 @@ cargo run --bin # 9 (elapsed: 33.18ยตs) ``` -To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr --bin `. +`day` is a shorthand for `cargo run --bin `. To run an optimized version for benchmarking, append the `--release` flag. Displayed _timings_ show the raw execution time of your solution without overhead (e.g. file reads). ### Run solutions for all days ```sh -cargo run +cargo all # output: # Running `target/release/aoc` @@ -111,7 +111,7 @@ cargo run # Total: 0.20ms ``` -To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr`. +`all` is an alias for `cargo run`. To run an optimized version for benchmarking, use the `--release` flag. _Total timing_ is computed from individual solution _timings_ and excludes as much overhead as possible. diff --git a/src/bin/scaffold.rs b/src/bin/scaffold.rs index dc14146..3375f56 100644 --- a/src/bin/scaffold.rs +++ b/src/bin/scaffold.rs @@ -101,5 +101,5 @@ fn main() { } println!("---"); - println!("๐ŸŽ„ Type `cargo run --bin {}` to run your solution.", &day_padded); + println!("๐ŸŽ„ Type `cargo day {}` to run your solution.", &day_padded); }