advent2021/gettoday

20 lines
355 B
Bash
Executable File

#!/usr/bin/env bash
year=2021
day="$(date +%d | sed 's/^0//')"
case $# in
2)
year=$2
day=$1
specifyyear=_$year;;
1)
day=$1
esac
file=input$day$specifyyear
cd ~/repos/advent2021 || exit 42
curl -s -o "$file" -H "Cookie: session=$(cat cookie)" \
"https://adventofcode.com/$year/day/$day/input"
git add "$file"