Add day helper
CHECKPOINT
This commit is contained in:
parent
9184f6adfd
commit
f53e0b0d00
2 changed files with 28 additions and 0 deletions
17
2022/day
Executable file
17
2022/day
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BASEDIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
|
||||
|
||||
N=$(printf '%02d\n' "$1")
|
||||
|
||||
input="${BASEDIR}/input/day${N}.txt"
|
||||
bin="${BASEDIR}/src/bin/day${N}.rs"
|
||||
|
||||
template="${BASEDIR}/src/bin/dayXX.rs.tmpl"
|
||||
|
||||
touch "${input}"
|
||||
sed "s/dayXX/day${N}/g" "${template}" > "${bin}"
|
||||
|
||||
"${EDITOR}" -- "${input}" "${bin}"
|
||||
11
2022/src/bin/dayXX.rs.tmpl
Normal file
11
2022/src/bin/dayXX.rs.tmpl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
const INPUT: &str = include_str!("../../input/dayXX.txt");
|
||||
|
||||
fn main() {
|
||||
println!("{}", part1(INPUT));
|
||||
}
|
||||
|
||||
fn part1(input: &str) -> usize {
|
||||
for line in input.split('\n').filter(|l| !l.is_empty()) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue