update for current year

This commit is contained in:
Chris Sexton 2020-11-18 10:49:01 -05:00
parent d5417d4b61
commit e4b21fc080
1 changed files with 6 additions and 5 deletions

View File

@ -6,12 +6,13 @@ import (
"log"
"os"
"strconv"
"time"
"code.chrissexton.org/cws/getaoc"
)
var year = flag.Int("year", 2019, "event year")
var sessId = flag.String("session", "", "session id")
var year = flag.Int("year", time.Now().Year(), "event year")
var sessID = flag.String("session", "", "session id")
var file = flag.String("file", "input.txt", "filename (- for stdout)")
const base = "https://adventofcode.com"
@ -25,13 +26,13 @@ func main() {
day, _ := strconv.Atoi(flag.Arg(0))
sess, ok := os.LookupEnv("AOC_SESSION")
if !ok && *sessId == "" {
if !ok && *sessID == "" {
fmt.Fprintln(os.Stderr, "Error: Must provide a session id.")
return
}
if *sessId != "" {
sess = *sessId
if *sessID != "" {
sess = *sessID
}
body, err := getaoc.GetInput(sess, *year, day)