diff options
| author | 2026-01-07 21:01:09 +0100 | |
|---|---|---|
| committer | 2026-01-07 21:01:09 +0100 | |
| commit | 3b73a8edaff14039d917b1958715d1d54659851b (patch) | |
| tree | a4c378b8678ba76685cfd4af3be2904b62104ab1 /example/simple-ex.zig | |
| parent | chore: update minimum_zig_version (diff) | |
| download | zig-clap-3b73a8edaff14039d917b1958715d1d54659851b.tar.gz zig-clap-3b73a8edaff14039d917b1958715d1d54659851b.tar.xz zig-clap-3b73a8edaff14039d917b1958715d1d54659851b.zip | |
chore: Update examples in README to use new std.Io
Diffstat (limited to 'example/simple-ex.zig')
| -rw-r--r-- | example/simple-ex.zig | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/example/simple-ex.zig b/example/simple-ex.zig index 7ab8d1e..f6a1c7f 100644 --- a/example/simple-ex.zig +++ b/example/simple-ex.zig | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | pub fn main() !void { | 1 | pub fn main() !void { |
| 2 | var gpa = std.heap.DebugAllocator(.{}){}; | 2 | var gpa_state = std.heap.DebugAllocator(.{}){}; |
| 3 | defer _ = gpa.deinit(); | 3 | const gpa = gpa_state.allocator(); |
| 4 | defer _ = gpa_state.deinit(); | ||
| 5 | |||
| 6 | var threaded: std.Io.Threaded = .init_single_threaded; | ||
| 7 | const io: std.Io = threaded.io(); | ||
| 4 | 8 | ||
| 5 | // First we specify what parameters our program can take. | 9 | // First we specify what parameters our program can take. |
| 6 | // We can use `parseParamsComptime` to parse a string into an array of `Param(Help)`. | 10 | // We can use `parseParamsComptime` to parse a string into an array of `Param(Help)`. |
| @@ -23,9 +27,6 @@ pub fn main() !void { | |||
| 23 | .ANSWER = clap.parsers.enumeration(YesNo), | 27 | .ANSWER = clap.parsers.enumeration(YesNo), |
| 24 | }; | 28 | }; |
| 25 | 29 | ||
| 26 | var threaded: std.Io.Threaded = .init_single_threaded; | ||
| 27 | const io: std.Io = threaded.io(); | ||
| 28 | |||
| 29 | var diag = clap.Diagnostic{}; | 30 | var diag = clap.Diagnostic{}; |
| 30 | var res = clap.parse(clap.Help, ¶ms, parsers, .{ | 31 | var res = clap.parse(clap.Help, ¶ms, parsers, .{ |
| 31 | .diagnostic = &diag, | 32 | .diagnostic = &diag, |