mirror of
https://github.com/Threnklyn/advent-of-code-go.git
synced 2026-05-19 03:23:27 +02:00
2020 folder setup
This commit is contained in:
@@ -16,8 +16,10 @@ func panicWrap(err error, str string) {
|
||||
}
|
||||
|
||||
func ParseFlags() (day, year int, cookie string) {
|
||||
flag.IntVar(&day, "day", time.Now().Day(), "day number to fetch, 1-25")
|
||||
flag.IntVar(&year, "year", 2020, "AOC year")
|
||||
today := time.Now()
|
||||
flag.IntVar(&day, "day", today.Day(), "day number to fetch, 1-25")
|
||||
flag.IntVar(&year, "year", today.Year(), "AOC year")
|
||||
// env variable set via .bash_profile/.zshenv/etc
|
||||
flag.StringVar(&cookie, "cookie", os.Getenv("AOC_SESSION_COOKIE"), "AOC session cookie")
|
||||
flag.Parse()
|
||||
|
||||
|
||||
@@ -53,9 +53,11 @@ func main() {
|
||||
fmt.Println("Running part", part)
|
||||
|
||||
if part == 1 {
|
||||
part1(util.ReadFile("./input.txt"))
|
||||
ans := part1(util.ReadFile("./input.txt"))
|
||||
fmt.Println("Output:", ans)
|
||||
} else {
|
||||
part2(util.ReadFile("./input.txt"))
|
||||
ans := part2(util.ReadFile("./input.txt"))
|
||||
fmt.Println("Output:", ans)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user