22 lines
450 B
Bash
Executable File
22 lines
450 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
export PUZZLE_NAME="$1"
|
|
|
|
export DAY="${2:-$(date +%d)}"
|
|
export DAY_SHORT=$(($DAY))
|
|
|
|
year=$(date +%Y)
|
|
dir="$year/day_$DAY"
|
|
|
|
mkdir "$dir"
|
|
|
|
envsubst < "solution.ts.template" > "$dir/solution.ts"
|
|
envsubst < "solution.test.ts.template" > "$dir/solution.test.ts"
|
|
|
|
touch "$dir/sample.txt"
|
|
|
|
curl -H "Cookie: $(cat ./session.cookie)" \
|
|
"https://adventofcode.com/$year/day/$DAY_SHORT/input" \
|
|
-o "$dir"/input.txt
|