package main import ( "advent_of_code_2024/day_01" "advent_of_code_2024/day_02" _ "embed" "fmt" "os" ) func main() { selectedDay := selectSolutionRun() switch selectedDay { case "01-basic": fmt.Printf("Day 01. Basic: %d\n", day_01.SolveBasic(Day01Data)) // 2113135 case "01-complex": fmt.Printf("Day 01. Complex: %d\n", day_01.SolveComplex(Day01Data)) // 19097157 case "02-basic": fmt.Printf("Day 02. Basic: %d\n", day_02.SolveBasic(Day02Data)) // 690 case "02-complex": fmt.Printf("Day 02. Complex: %d\n", day_02.SolveComplex(Day02Data)) // 710 } } func selectSolutionRun() string { selectedDay := "" if len(os.Args) == 2 { // if command line arg passed use that selectedDay = os.Args[1] } else if len(os.Args) == 1 { // otherwise ask user for the solution fmt.Printf("Enter the solution to be run: e.g. 01-basic,21-complex...\n") if _, err := fmt.Scan(&selectedDay); err != nil { panic(err) } } else { // if too many arguments are passed return error message fmt.Printf("Invalid number of arguments\nUsage: %s day-basic|day-complex\n e.g. %s 01-basic", os.Args[0], os.Args[0]) os.Exit(1) } return selectedDay }