AdventOfCode2023/new.sh

19 lines
579 B
Bash
Raw Normal View History

2023-12-02 01:01:27 +00:00
#!/bin/bash
__year=2023
if [ "${1}" != "" ]; then
padded=$(printf "%02g" ${1})
mkdir -p ${padded}/inputs
touch ${padded}/inputs/testinput
if [ ! -f "${padded}/inputs/input" ]; then
curl -s \
-A "https://git.yetaga.in/alazyreader/AdventOfCode${__year}/" \
-H "Cookie: session=`cat .cookie`" https://adventofcode.com/${__year}/day/${1##0}/input > "${padded}/inputs/input"
fi
if [ ! -f "${padded}/main.go" ]; then
cp -n main.go.tmpl ${padded}/main.go
fi
echo "https://adventofcode.com/${__year}/day/${1}"
fi