Skip to content

Commit

Permalink
Add header to generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
dpwm committed Feb 24, 2025
1 parent b5bf5ae commit e530fc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/refactor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ pub fn Refactor(comptime W: type) type {
pub fn writeNode(ctx: *WriteContext, name: []const u8, node: schema.Node.Reader) E!void {
switch (node.which()) {
.file => {
try ctx.writer.print("// {s}\n", .{name});
try ctx.writer.writeAll("// This file is automatically generated. DO NOT EDIT.\n\n");
try ctx.writer.writeAll("const _Root = @This();\nconst capnp = @import(\"capnp.zig\");\n\n");

const nested_nodes = try node.getNestedNodes();
for (0..nested_nodes.length) |i| {
const nested_node = nested_nodes.get(@intCast(i));
Expand Down

0 comments on commit e530fc4

Please sign in to comment.