const std = @import("std"); const noclip = @import("noclip"); const config = @import("./config.zig"); const scribe_cmd = cmd: { var builder = noclip.CommandBuilder(*const std.mem.Allocator){ .description = \\consume lore files and produce rendered output \\ \\ , }; builder.stringArgument(.{ .name = "input", .description = "document to parse", }); break :cmd builder; }; pub fn scribe(alloc: *const std.mem.Allocator, options: scribe_cmd.Output()) !void { const buffa = try std.fs.cwd().readFileAlloc(alloc.*, options.input, 4_294_967_295); defer alloc.free(buffa); var parser = config.Parser{ .allocator = alloc.*, // .dupe_behavior = .use_last, }; const document = try parser.parseBuffer(buffa); defer document.deinit(); document.printDebug(); } pub fn run(alloc: std.mem.Allocator) !void { const base = try noclip.commandGroup(alloc, .{ .description = \\produce and manipulate collections of lore \\ , }); defer base.deinitTree(); try base.addSubcommand("scribe", try scribe_cmd.createInterface(alloc, scribe, &alloc)); try base.execute(); }