Skip to content

Commit

Permalink
Add --main-only argument
Browse files Browse the repository at this point in the history
  • Loading branch information
samueltardieu committed Sep 23, 2023
1 parent 31bbed2 commit e56f3f1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion aoc/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ struct Opts {
/// Show timing information
timing: bool,

#[clap(short, long)]
/// Skip running any alternate version
main_only: bool,

#[clap(short, long)]
/// Use alternate input (file or string)
input: Option<String>,
Expand Down Expand Up @@ -46,7 +50,7 @@ pub fn run<F>(register: F) -> eyre::Result<()>
where
F: Fn(),
{
color_eyre::install().unwrap();
color_eyre::install()?;
let opts = Opts::parse();
if opts.day.is_some() && opts.all {
eyre::bail!("--all and --day are not compatible");
Expand All @@ -64,6 +68,9 @@ where
for (day, part) in keys {
if day == current_day || opts.all {
for (version, runner) in runners.remove(&(day, part)).unwrap() {
if opts.main_only && version.is_some() {
continue;
}
let before = chrono::Utc::now();
let result = runner();
let after = chrono::Utc::now();
Expand Down

0 comments on commit e56f3f1

Please sign in to comment.