authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-01 01:24:48 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-01 01:24:48 -08:00
log6c0021b9315cc1450ca37f2f56493b6b4548a413
tree807a9f420b4cbf4e4fa91eec7ec603323f99f160
parentf01f9bf9f529058d8907e89334f96340e12269f2

cmd/init: ask if zigmod should write a test.zig


1 files changed, 20 insertions(+), 0 deletions(-)

src/cmd/init.zig+20
......@@ -268,6 +268,26 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
268268 }
269269 }
270270 }
271
272 // ask about test.zig
273 if (!try extras.doesFileExist(null, "test.zig")) {
274 const do = try inquirer.forConfirm(stdout, stdin, "It looks like there's no test.zig. Do you want Zigmod to generate it for you?", gpa);
275 if (do) {
276 const file = try cwd.createFile("test.zig", .{});
277 defer file.close();
278 const w = file.writer();
279 try w.print(
280 \\const std = @import("std");
281 \\const {s} = @import("{s}");
282 \\
283 ,
284 .{
285 flatname,
286 name,
287 },
288 );
289 }
290 }
271291}
272292
273293pub fn writeExeManifest(w: std.fs.File.Writer, id: string, name: string, license: ?string, description: ?string) !void {