summaryrefslogtreecommitdiff
path: root/example/simple.zig
diff options
context:
space:
mode:
authorGravatar Devin J. Pohly2023-04-02 06:10:40 -0500
committerGravatar GitHub2023-04-02 13:10:40 +0200
commitab69ef2db44b6c4b7f00283d52d38fbe71d16c42 (patch)
tree10416c0cdda32ba98d54954940c440beac6ccf08 /example/simple.zig
parentUpdate build script to actually run the tests (diff)
downloadzig-clap-ab69ef2db44b6c4b7f00283d52d38fbe71d16c42.tar.gz
zig-clap-ab69ef2db44b6c4b7f00283d52d38fbe71d16c42.tar.xz
zig-clap-ab69ef2db44b6c4b7f00283d52d38fbe71d16c42.zip
Count occurrences of flags (was "Add .count type for flags") (#96)
Breaking change: parseEx now counts the number of occurrences of flag parameters (those with takes_value == .none) and returns the count as a u8. Users of the library will need to change if (arg_result.my_flag) to if (arg_result.my_flag != 0)
Diffstat (limited to '')
-rw-r--r--example/simple.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/example/simple.zig b/example/simple.zig
index 2d32463..429f095 100644
--- a/example/simple.zig
+++ b/example/simple.zig
@@ -28,7 +28,7 @@ pub fn main() !void {
28 }; 28 };
29 defer res.deinit(); 29 defer res.deinit();
30 30
31 if (res.args.help) 31 if (res.args.help != 0)
32 debug.print("--help\n", .{}); 32 debug.print("--help\n", .{});
33 if (res.args.number) |n| 33 if (res.args.number) |n|
34 debug.print("--number = {}\n", .{n}); 34 debug.print("--number = {}\n", .{n});