//! Writes every builtin as JSON to the path given (docs/typ/builtins-.json, //! by way of `zig build builtins-json`), then the words of the addons whose //! sources follow it (builtins_json.addons, in that order). const std = @import("std"); const pardes = @import("pardes"); pub fn main(init: std.process.Init) !void { const args = try init.minimal.args.toSlice(init.arena.allocator()); var sources: [pardes.builtins_json.addons.len][]const u8 = undefined; for (&sources, args[2..][0..sources.len]) |*source, path| source.* = try std.Io.Dir.cwd().readFileAlloc(init.io, path, init.arena.allocator(), .limited(1 << 20)); var file = try std.Io.Dir.cwd().createFile(init.io, args[1], .{}); defer file.close(init.io); var buf: [4096]u8 = undefined; var w = file.writer(init.io, &buf); try pardes.builtins_json.write(&w.interface, &sources); try w.interface.flush(); }