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.zig10
1 files changed, 3 insertions, 7 deletions
diff --git a/example/streaming-clap.zig b/example/streaming-clap.zig
index 32d44c4..5f7f219 100644
--- a/example/streaming-clap.zig
+++ b/example/streaming-clap.zig
@@ -39,22 +39,18 @@ pub fn main() !void {
39 // Because we use a streaming parser, we have to consume each argument parsed individually. 39 // Because we use a streaming parser, we have to consume each argument parsed individually.
40 while (parser.next() catch |err| { 40 while (parser.next() catch |err| {
41 // Report useful error and exit 41 // Report useful error and exit
42<<<<<<< HEAD
43 diag.report(std.io.getStdErr().writer(), err) catch {};
44=======
45 diag.report(io.getStdErr().writer(), err) catch {}; 42 diag.report(io.getStdErr().writer(), err) catch {};
46>>>>>>> master
47 return err; 43 return err;
48 }) |arg| { 44 }) |arg| {
49 // arg.param will point to the parameter which matched the argument. 45 // arg.param will point to the parameter which matched the argument.
50 switch (arg.param.id) { 46 switch (arg.param.id) {
51 'h' => debug.warn("Help!\n", .{}), 47 'h' => debug.warn("Help!\n", .{}),
52 'n' => debug.warn("--number = {}\n", .{arg.value.?}), 48 'n' => debug.warn("--number = {s}\n", .{arg.value.?}),
53 49
54 // arg.value == null, if arg.param.takes_value == false. 50 // arg.value == null, if arg.param.takes_value == .none.
55 // Otherwise, arg.value is the value passed with the argument, such as "-a=10" 51 // Otherwise, arg.value is the value passed with the argument, such as "-a=10"
56 // or "-a 10". 52 // or "-a 10".
57 'f' => debug.warn("{}\n", .{arg.value.?}), 53 'f' => debug.warn("{s}\n", .{arg.value.?}),
58 else => unreachable, 54 else => unreachable,
59 } 55 }
60 } 56 }