-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
47 lines (40 loc) · 1.15 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
set quiet
# alias
self := justfile_dir()
venv := self / ".venv"
[private]
default:
just --list
# run solution for a given day - file can be input | example
run day file:
#!/usr/bin/env bash
set -euo pipefail # Exit on error
DAY=$(printf "%02d" {{day}})
uv run day${DAY}/solution.py day${DAY}/{{file}}.txt
# run tests for a given day x.
test day:
#!/usr/bin/env bash
set -euo pipefail # Exit on error
DAY=$(printf "%02d" {{day}})
uv run pytest day${DAY}
# activate the virtual environment
activate-venv:
source {{venv}}/bin/activate
# scafold template for the day x
scafold day:
#!/usr/bin/env bash
set -euo pipefail # Exit on error
DAY=$(printf "%02d" {{day}})
DIRECTORY={{self}}/day${DAY}
# check if does not exists.
if [ ! -d "$DIRECTORY" ]; then
cp -r {{self}}/template $DIRECTORY
touch $DIRECTORY/example.txt
# download input
source .env
curl -o $DIRECTORY/input.txt https://adventofcode.com/2024/day/{{day}}/input --cookie "session=$AOC_SESSION_COOKIE"
else
echo "Day {{day}} already exist."
fi
edit day:
${EDITOR} day{{day}}/solution.py