zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 041eedc1cf2a5b7d6489a44cee8a5037a4af675f (tree)
parent 1116d881965ed8c0009f2d5bb4f97eed605c4ec0
Author: Loris Cro <kappaloris@gmail.com>
Date:   Mon,  2 Jun 2025 15:42:21 +0200

zig init: appease zig fmt check

last commit introduced a templated variable name that made zig fmt angry

Diffstat:
Mlib/init/src/main.zig | 2+-
Msrc/main.zig | 6++++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/init/src/main.zig b/lib/init/src/main.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const .NAME = @import(".NAME"); +const _LITNAME = @import(".NAME"); pub fn main() !void { // Prints to stderr, ignoring potential errors. diff --git a/src/main.zig b/src/main.zig @@ -7426,6 +7426,12 @@ const Templates = struct { } if (templates.strip and contents[i] == '\n') { new_line = true; + } else if (contents[i] == '_') { + if (std.mem.startsWith(u8, contents[i..], "_LITNAME")) { + try templates.buffer.appendSlice(root_name); + i += "_LITNAME".len; + continue; + } } else if (contents[i] == '.') { if (std.mem.startsWith(u8, contents[i..], ".LITNAME")) { try templates.buffer.append('.');