aoc/setup_day.sh

22 lines
450 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
2023-12-02 01:01:55 +00:00
export PUZZLE_NAME="$1"
2023-12-10 20:19:14 +00:00
export DAY="${2:-$(date +%d)}"
2023-12-02 01:01:55 +00:00
export DAY_SHORT=$(($DAY))
2023-12-02 01:01:55 +00:00
year=$(date +%Y)
dir="$year/day_$DAY"
2023-12-02 05:54:53 +00:00
mkdir "$dir"
2023-12-02 05:54:53 +00:00
envsubst < "solution.ts.template" > "$dir/solution.ts"
2023-12-02 01:01:55 +00:00
envsubst < "solution.test.ts.template" > "$dir/solution.test.ts"
2023-12-02 01:01:55 +00:00
touch "$dir/sample.txt"
2023-12-02 01:01:55 +00:00
curl -H "Cookie: $(cat ./session.cookie)" \
"https://adventofcode.com/$year/day/$DAY_SHORT/input" \
-o "$dir"/input.txt