diff options
| author | 2026-01-02 20:59:20 +0900 | |
|---|---|---|
| committer | 2026-01-02 20:59:20 +0900 | |
| commit | 3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe (patch) | |
| tree | 71b3c0023650979eceee27bc37f507d2e73a7e17 /example/simple.zig | |
| parent | hotfix: replace deprecated std.fs.File with std.Io.File for Zig v0.16 (diff) | |
| download | zig-clap-3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe.tar.gz zig-clap-3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe.tar.xz zig-clap-3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe.zip | |
chore: update examples to use std.Io for Zig v0.16 compatibility
Signed-off-by: Takumi Katase <takumi.katase@devoc.ninja>
Diffstat (limited to 'example/simple.zig')
| -rw-r--r-- | example/simple.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/example/simple.zig b/example/simple.zig index abcf448..67313aa 100644 --- a/example/simple.zig +++ b/example/simple.zig | |||
| @@ -16,12 +16,14 @@ pub fn main() !void { | |||
| 16 | // This is optional. You can also pass `.{}` to `clap.parse` if you don't | 16 | // This is optional. You can also pass `.{}` to `clap.parse` if you don't |
| 17 | // care about the extra information `Diagnostics` provides. | 17 | // care about the extra information `Diagnostics` provides. |
| 18 | var diag = clap.Diagnostic{}; | 18 | var diag = clap.Diagnostic{}; |
| 19 | var threaded: std.Io.Threaded = .init_single_threaded; | ||
| 20 | const io: std.Io = threaded.io(); | ||
| 19 | var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ | 21 | var res = clap.parse(clap.Help, ¶ms, clap.parsers.default, .{ |
| 20 | .diagnostic = &diag, | 22 | .diagnostic = &diag, |
| 21 | .allocator = gpa.allocator(), | 23 | .allocator = gpa.allocator(), |
| 22 | }) catch |err| { | 24 | }) catch |err| { |
| 23 | // Report useful error and exit. | 25 | // Report useful error and exit. |
| 24 | try diag.reportToFile(.stderr(), err); | 26 | try diag.reportToFile(io, .stderr(), err); |
| 25 | return err; | 27 | return err; |
| 26 | }; | 28 | }; |
| 27 | defer res.deinit(); | 29 | defer res.deinit(); |