AdventOfCode2022/new.sh
2022-12-03 07:01:53 -05:00

19 lines
569 B
Bash
Executable File

#!/bin/bash
__year=2022
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/AdventOfCode2022/" \
-H "Cookie: session=`cat .cookie`" https://adventofcode.com/${__year}/day/${1##0}/input > "${padded}/inputs/input"
fi
if [ ! -f "${padded}/main.rs" ]; then
cp -n main.rs.tmpl ${padded}/main.rs
fi
echo "https://adventofcode.com/2022/day/${1}"
fi