Skip to content

Commit 6f95ede

Browse files
authored
Merge pull request #12 from swlody/run-current-day
Run only most recent day by default
2 parents 97e6425 + 56f6717 commit 6f95ede

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ pub fn args(year: u16) -> App<'static> {
4545
.long("bench")
4646
.about("Run criterion benchmarks"),
4747
)
48+
.arg(
49+
Arg::new("all")
50+
.short('a')
51+
.long("all")
52+
.conflicts_with("days")
53+
.about("Run all days"),
54+
)
4855
}
4956

5057
#[macro_export]
@@ -83,11 +90,18 @@ macro_rules! base_main {
8390
.into_iter()
8491
.filter(|day| days.contains(&format!("day{}", day).as_str()))
8592
.collect()
86-
} else {
93+
} else if opt.is_present("all") {
8794
parse!(extract_day {}; $( $tail )*)
8895
.iter()
8996
.map(|s| &s[3..])
9097
.collect()
98+
} else {
99+
// Get most recent day, assuming the days are sorted
100+
vec![parse!(extract_day {}; $( $tail )*)
101+
.iter()
102+
.map(|s| &s[3..])
103+
.last()
104+
.expect("No day implemenations found")]
91105
}
92106
};
93107

0 commit comments

Comments
 (0)