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}"
|
||||
Loading…
Reference in a new issue