1const std = @import("std");
2const day1 = @import("day1.zig");
3const day2 = @import("day2.zig");
4
5pub export fn main() void {
6 for (1..std.os.argv.len) |i| {
7 const day = std.mem.span(std.os.argv[i]);
8
9 if (std.mem.eql(u8, "day1", day)) {
10 print(day1.pt1(@embedFile("./input/day1")));
11 print(day1.pt2(@embedFile("./input/day1")));
12 } else if (std.mem.eql(u8, "day2", day)) {
13 print(day2.pt1(@embedFile("./input/day2")));
14 print(day2.pt2(@embedFile("./input/day2")));
15 }
16 }
17}
18
19fn print(res: anytype) void {
20 const ArgsType = @TypeOf(res);
21 const res_type_info = @typeInfo(ArgsType);
22 if (res_type_info == .int) {
23 std.debug.print("{d}\n", .{res});
24 } else {
25 @compileError("print not implemented for this type");
26 }
27}