diff --git a/tools/html-generator.zig b/tools/html-generator.zig new file mode 100644 index 00000000..6eec8dd2 --- /dev/null +++ b/tools/html-generator.zig @@ -0,0 +1,26 @@ +const std = @import("std"); + +const source = @embedFile("../www/template.html"); + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + const allocator = gpa.allocator(); + defer _ = gpa.deinit(); + + const args = try std.process.argsAlloc(allocator); + defer std.process.argsFree(allocator, args); + + if (args.len < 3) { + std.debug.print("Usage: html-generator \n", .{}); + return; + } + + const output_name = args[1]; + const application_name = args[2]; + + const file = try std.fs.cwd().createFile(output_name, std.fs.File.CreateFlags{}); + defer file.close(); + + const writer = file.writer(); + try std.fmt.format(writer, source, .{application_name}); +} diff --git a/www/template.html b/www/template.html index d5e7d393..edc9588d 100644 --- a/www/template.html +++ b/www/template.html @@ -3,35 +3,35 @@