~subsetpark/erasmus

b3743880d759db04a84f41d28919b5720fc1c0bd — Zach Smith a month ago 3013b69
Lowercase when escaping
1 files changed, 10 insertions(+), 10 deletions(-)

M src/main.zig
M src/main.zig => src/main.zig +10 -10
@@ 165,12 165,11 @@ fn escape(s: []const u8, res: *EscapedString) RuntimeError!void {
        switch (char) {
            ' ' => {
                res.escaped.appendAssumeCapacity('\\');
                res.escaped.appendAssumeCapacity(char);
            },
            else => {
                res.escaped.appendAssumeCapacity(char);
            },
            else => {},
        }
        const lower_char = std.ascii.toLower(char);
        res.escaped.appendAssumeCapacity(lower_char);
    }
}



@@ 266,20 265,21 @@ pub fn main() !void {

    // Process CLI args.
    var maybe_directory_name: ?[]const u8 = null;
    var args = std.process.args();
    var args = try std.process.argsWithAllocator(allocator);
    // Skip the program name.
    _ = args.skip();
    while (args.next(allocator)) |arg| {
        const inner_arg = try arg;
        if (mem.eql(u8, inner_arg, "-d")) {
    while (args.next()) |arg| {
        if (mem.eql(u8, arg, "-d")) {
            debug_mode = true;
        } else if (mem.eql(u8, inner_arg, "-h")) {
        } else if (mem.eql(u8, arg, "-h")) {
            std.debug.print(help_text, .{});
            std.os.exit(0);
        } else if (maybe_directory_name == null) {
            maybe_directory_name = inner_arg;
            maybe_directory_name = arg;
        }
    }
    args.deinit();

    const directory_name = maybe_directory_name orelse ".";

    var notes = std.ArrayList(Note).init(allocator);