diff --git a/cmd/getaoc/main.go b/cmd/getaoc/main.go index ac5fe68..8bbc3ef 100644 --- a/cmd/getaoc/main.go +++ b/cmd/getaoc/main.go @@ -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)