1
0
Fork 0

Solve day 1

This commit is contained in:
Lars Martens 2023-12-01 11:50:28 +01:00
commit 646925298c
Signed by: haselkern
GPG key ID: B5CF1F363C179AD4
9 changed files with 316 additions and 0 deletions

28
justfile Normal file
View file

@ -0,0 +1,28 @@
set dotenv-load
day := `date +%d`
dayWithout0 := trim_start_match(day, "0")
year := "2023"
file := "src/bin/" + day + ".rs"
# Format, lint, and run the program for today.
run: _output-folder
rustfmt src/bin/{{day}}.rs
cargo clippy
# Hide warning here because we just ran clippy
RUSTFLAGS=-Awarnings cargo run --release --bin {{day}} | tee "output/{{day}}.log"
# Begin working on todays problem. Downloads input, creates template and opens the problem and code.
begin: _input-folder
echo "use aoc2023::*; const INPUT: &str = include_str!(\"../../input/{{day}}\"); const TEST_INPUT: &str = include_str!(\"../../input/{{day}}-test\"); fn main() {}" >> {{file}}
rustfmt {{file}}
curl --silent "https://adventofcode.com/{{year}}/day/{{dayWithout0}}/input" -H "Cookie: session=$AOC_SESSION" > "input/{{day}}"
touch input/{{day}}-test
rustrover {{file}}
open "https://adventofcode.com/{{year}}/day/{{dayWithout0}}"
_output-folder:
mkdir -p output
_input-folder:
mkdir -p input