| ... | @@ -268,6 +268,26 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { | ... | @@ -268,6 +268,26 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void { |
| 268 | } | 268 | } |
| 269 | } | 269 | } |
| 270 | } | 270 | } |
| | 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 | } |
| 271 | } | 291 | } |
| 272 | | 292 | |
| 273 | pub fn writeExeManifest(w: std.fs.File.Writer, id: string, name: string, license: ?string, description: ?string) !void { | 293 | pub fn writeExeManifest(w: std.fs.File.Writer, id: string, name: string, license: ?string, description: ?string) !void { |