From f181d2d706f44dfdb4f49203312cc3a013636ed0 Mon Sep 17 00:00:00 2001 From: alex <> Date: Sun, 8 Dec 2024 08:33:17 +0100 Subject: [PATCH] =?utf8?q?R=C3=A8gle=20pour=20r=C3=A9cup=C3=A9rer=20l?= =?utf8?q?=E2=80=99input?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Nécessite un fichier .cookie avec le cookie de session. --- .gitignore | 2 ++ Makefile | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 05cc302..ae5fb86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ Cargo.lock /target +.cookie + *.sw* diff --git a/Makefile b/Makefile index 57a9883..7e9bc59 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,16 @@ new-day%: -e "/_ =>/i\ \"$(subst new-,,$@)\" => $(subst new-,,$@)::run(\&input)?," \ src/main.rs +# Requires a .cookie file +# do not use leading 0 +# make input-1 +# make input-10 +input-%: + [ ! -f .cookie ] && echo "Missing .cookie file" && return 1 || true + curl -o input/day$$(printf "%02d" $(subst input-,,$@)).txt \ + -H "Cookie: session=$$(cat .cookie)" \ + "https://adventofcode.com/2024/day/$(subst input-,,$@)/input" + # run the tests for a specific day test-day%: cargo test $(subst test-,,$@)::tests -- --nocapture -- 2.39.5