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-ex.zig | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'example/simple-ex.zig') diff --git a/example/simple-ex.zig b/example/simple-ex.zig index 0d90b69..c35b867 100644 --- a/example/simple-ex.zig +++ b/example/simple-ex.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( @@ -28,15 +21,15 @@ pub fn main() !void { }; var diag = clap.Diagnostic{}; - var res = clap.parse(clap.Help, ¶ms, parsers, .{ + var res = clap.parse(clap.Help, ¶ms, parsers, init.minimal.args, .{ .diagnostic = &diag, - .allocator = gpa, + .allocator = init.gpa, // The assignment separator can be configured. `--number=1` and `--number:1` is now // allowed. .assignment_separators = "=:", }) 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