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/simple.zig | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'example/simple.zig') diff --git a/example/simple.zig b/example/simple.zig index a7772c6..7ed1d84 100644 --- a/example/simple.zig +++ b/example/simple.zig @@ -1,11 +1,4 @@ -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 { // First we specify what parameters our program can take. // We can use `parseParamsComptime` to parse a string into an array of `Param(Help)`. const params = comptime clap.parseParamsComptime( @@ -20,12 +13,12 @@ pub fn main() !void { // This is optional. You can also pass `.{}` to `clap.parse` if you don't // care about the extra information `Diagnostics` provides. var diag = clap.Diagnostic{}; - var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ + var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, init.minimal.args, .{ .diagnostic = &diag, - .allocator = gpa, + .allocator = init.gpa, }) catch |err| { // Report useful error and exit. - try diag.reportToFile(io, .stderr(), err); + try diag.reportToFile(init.io, .stderr(), err); return err; }; defer res.deinit(); -- cgit v1.2.3