const std = @import("std"); const print = std.debug.print; const day01 = @import("src/day01.zig"); const day02 = @import("src/day02.zig"); const day03 = @import("src/day03.zig"); const day04 = @import("src/day04.zig"); const day05 = @import("src/day05.zig"); const day06 = @import("src/day06.zig"); pub fn main() !void { if (std.os.argv.len != 3) { print("Usage: {s} < \n", .{std.os.argv[0]}); return; } const stdin = std.io.getStdIn(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); defer { _ = gpa.deinit(); } const stat = try stdin.stat(); const buffer = try stdin.readToEndAlloc(allocator, stat.size); defer allocator.free(buffer); const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); const day = std.fmt.parseInt(usize, args[1], 10) catch { print("Not valid day format\n: {s}", .{args[1]}); return; }; try switch (day) { 1 => day01.solve(args[2], buffer, allocator), 2 => day02.solve(args[2], buffer), 3 => day03.solve(args[2], buffer, allocator), 4 => day04.solve(args[2], buffer, allocator), 5 => day05.solve(args[2], buffer, allocator), 6 => day06.solve(args[2], buffer, allocator), else => print("Day not yet implemented", .{}), }; }