diff options
| author | 2026-01-02 20:59:20 +0900 | |
|---|---|---|
| committer | 2026-01-02 20:59:20 +0900 | |
| commit | 3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe (patch) | |
| tree | 71b3c0023650979eceee27bc37f507d2e73a7e17 /example/streaming-clap.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 '')
| -rw-r--r-- | example/streaming-clap.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/example/streaming-clap.zig b/example/streaming-clap.zig index 4cd6962..c58cd24 100644 --- a/example/streaming-clap.zig +++ b/example/streaming-clap.zig | |||
| @@ -31,10 +31,13 @@ pub fn main() !void { | |||
| 31 | .diagnostic = &diag, | 31 | .diagnostic = &diag, |
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | var threaded: std.Io.Threaded = .init_single_threaded; | ||
| 35 | const io: std.Io = threaded.io(); | ||
| 36 | |||
| 34 | // Because we use a streaming parser, we have to consume each argument parsed individually. | 37 | // Because we use a streaming parser, we have to consume each argument parsed individually. |
| 35 | while (parser.next() catch |err| { | 38 | while (parser.next() catch |err| { |
| 36 | // Report useful error and exit. | 39 | // Report useful error and exit. |
| 37 | try diag.reportToFile(.stderr(), err); | 40 | try diag.reportToFile(io, .stderr(), err); |
| 38 | return err; | 41 | return err; |
| 39 | }) |arg| { | 42 | }) |arg| { |
| 40 | // arg.param will point to the parameter which matched the argument. | 43 | // arg.param will point to the parameter which matched the argument. |