summaryrefslogtreecommitdiff
path: root/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'main.zig')
-rw-r--r--main.zig15
1 files changed, 9 insertions, 6 deletions
diff --git a/main.zig b/main.zig
index 4facde2..871eec2 100644
--- a/main.zig
+++ b/main.zig
@@ -3,8 +3,8 @@ const print = std.debug.print;
const day01 = @import("src/day01.zig");
const day02 = @import("src/day02.zig");
-
-const Day = enum { day01, day02 };
+const day03 = @import("src/day03.zig");
+const day04 = @import("src/day04.zig");
pub fn main() !void {
if (std.os.argv.len != 3) {
@@ -27,13 +27,16 @@ pub fn main() !void {
const args = try std.process.argsAlloc(allocator);
defer std.process.argsFree(allocator, args);
- const day = std.meta.stringToEnum(Day, args[1]) orelse {
- print("Not valid day or day not yet implemented\n: {s}", .{args[1]});
+ const day = std.fmt.parseInt(usize, args[1], 10) catch {
+ print("Not valid day format\n: {s}", .{args[1]});
return;
};
try switch (day) {
- .day01 => day01.solve(args[2], buffer, allocator),
- .day02 => day02.solve(args[2], buffer),
+ 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),
+ else => print("Day not yet implemented", .{}),
};
}