const std = @import("std"); const rats = @import("rats"); const version = "0.0.0"; // TODO: pull this from build.zig.zon pub fn main() !void { var gpa: std.heap.DebugAllocator(.{}) = .init; defer std.debug.assert(gpa.deinit() == .ok); const allocator = gpa.allocator(); var file_path: ?[]const u8 = null; { // argument parsing var args = try std.process.argsWithAllocator(allocator); defer args.deinit(); _ = args.next(); // Discargd argv[0]; while (args.next()) |arg| { const eql = std.mem.eql; if (file_path != null) { std.debug.print("Ignoring argument after file path: {s}\n", .{arg}); } else if (eql(u8, arg, "-h") or eql(u8, arg, "--help")) { std.debug.print( \\Usage: rats [options] [file] \\ \\Options: \\ -h, --help Display this help and exit. \\ -v, --version Display version information and exit. \\ , .{}); return; } else if (eql(u8, arg, "-v") or eql(u8, arg, "--version")) { std.debug.print("rats v{s}\n", .{version}); return; } else { file_path = arg; } } } // end argument parsing const use_stdin = (file_path == null) or std.mem.eql(u8, file_path.?, "-"); std.debug.print( \\File path: {?s} \\Stdin mode: {} \\ , .{ file_path, use_stdin }); // TODO: actually parse and run the file, or do a repl on stdin. }