package main import ( adventoc2024 "adventoc/2024" "bytes" "flag" "fmt" "io" "log" "os" ) type puzzle interface { Part1(io.Reader) string Part2(io.Reader) string } var puzzles = map[string]puzzle{ "1": adventoc2024.Day1{}, "2": adventoc2024.Day2{}, "3": adventoc2024.Day3{}, "4": adventoc2024.Day4{}, } func main() { flag.Parse() puzzle, ok := puzzles[flag.Arg(0)] if !ok { log.Fatalf("invalid puzzle day %s", flag.Arg(0)) } buf := new(bytes.Buffer) tee := io.TeeReader(os.Stdin, buf) fmt.Println("Part 1:", puzzle.Part1(tee)) fmt.Println("Part 2:", puzzle.Part2(buf)) }