From 1d3d273524e3c180f015ff1e93c83075e4634e2c Mon Sep 17 00:00:00 2001 From: darcy Date: Sun, 25 Jan 2026 09:27:04 +1100 Subject: fix: use new `std.process.Init` args for Zig `0.16.0-dev.2261+d6b3dd25a` (#175) --- example/help.zig | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'example/help.zig') diff --git a/example/help.zig b/example/help.zig index b07bc52..a41b261 100644 --- a/example/help.zig +++ b/example/help.zig @@ -1,18 +1,11 @@ -pub fn main() !void { - var gpa_state = std.heap.DebugAllocator(.{}){}; - const gpa = gpa_state.allocator(); - defer _ = gpa_state.deinit(); - - var threaded: std.Io.Threaded = .init_single_threaded; - const io: std.Io = threaded.io(); - +pub fn main(init: std.process.Init) !void { const params = comptime clap.parseParamsComptime( \\-h, --help Display this help and exit. \\-v, --version Output version information and exit. \\ ); - var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ .allocator = gpa }); + var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, init.minimal.args, .{ .allocator = init.gpa }); defer res.deinit(); // `clap.help` is a function that can print a simple help message. It can print any `Param` @@ -20,7 +13,7 @@ pub fn main() !void { // The last argument contains options as to how `help` should print those parameters. Using // `.{}` means the default options. if (res.args.help != 0) - return clap.helpToFile(io, .stderr(), clap.Help, ¶ms, .{}); + return clap.helpToFile(init.io, .stderr(), clap.Help, ¶ms, .{}); } const clap = @import("clap"); -- cgit v1.2.3