summaryrefslogtreecommitdiff
path: root/example/streaming-clap.zig
diff options
context:
space:
mode:
Diffstat (limited to 'example/streaming-clap.zig')
-rw-r--r--example/streaming-clap.zig5
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.