Zig 0.15: webdata

pull/9004/head
Mitchell Hashimoto 2025-10-02 15:41:59 -07:00
parent f0cfaa9580
commit 9ec3b1b152
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
3 changed files with 15 additions and 9 deletions

View File

@ -3,6 +3,8 @@ const help_strings = @import("help_strings");
const helpgen_actions = @import("../../input/helpgen_actions.zig"); const helpgen_actions = @import("../../input/helpgen_actions.zig");
pub fn main() !void { pub fn main() !void {
const output = std.io.getStdOut().writer(); var buffer: [2048]u8 = undefined;
try helpgen_actions.generate(output, .markdown, true, std.heap.page_allocator); var stdout_writer = std.fs.File.stdout().writer(&buffer);
const stdout = &stdout_writer.interface;
try helpgen_actions.generate(stdout, .markdown, true, std.heap.page_allocator);
} }

View File

@ -3,14 +3,16 @@ const Action = @import("../../cli/ghostty.zig").Action;
const help_strings = @import("help_strings"); const help_strings = @import("help_strings");
pub fn main() !void { pub fn main() !void {
const output = std.io.getStdOut().writer(); var buffer: [2048]u8 = undefined;
try genActions(output); var stdout_writer = std.fs.File.stdout().writer(&buffer);
const stdout = &stdout_writer.interface;
try genActions(stdout);
} }
// Note: as a shortcut for defining inline editOnGithubLinks per cli action the user // Note: as a shortcut for defining inline editOnGithubLinks per cli action the user
// is directed to the folder view on Github. This includes a README pointing them to // is directed to the folder view on Github. This includes a README pointing them to
// the files to edit. // the files to edit.
pub fn genActions(writer: anytype) !void { pub fn genActions(writer: *std.Io.Writer) !void {
// Write the header // Write the header
try writer.writeAll( try writer.writeAll(
\\--- \\---

View File

@ -3,11 +3,13 @@ const Config = @import("../../config/Config.zig");
const help_strings = @import("help_strings"); const help_strings = @import("help_strings");
pub fn main() !void { pub fn main() !void {
const output = std.io.getStdOut().writer(); var buffer: [2048]u8 = undefined;
try genConfig(output); var stdout_writer = std.fs.File.stdout().writer(&buffer);
const stdout = &stdout_writer.interface;
try genConfig(stdout);
} }
pub fn genConfig(writer: anytype) !void { pub fn genConfig(writer: *std.Io.Writer) !void {
// Write the header // Write the header
try writer.writeAll( try writer.writeAll(
\\--- \\---
@ -122,7 +124,7 @@ pub fn genConfig(writer: anytype) !void {
} }
} }
fn endBlock(writer: anytype, block: anytype) !void { fn endBlock(writer: *std.Io.Writer, block: anytype) !void {
if (block) |v| switch (v) { if (block) |v| switch (v) {
.text => {}, .text => {},
.code => try writer.writeAll("```\n"), .code => try writer.writeAll("```\n"),