diff options
| author | 2022-03-23 20:05:28 +0100 | |
|---|---|---|
| committer | 2022-03-23 21:48:20 +0100 | |
| commit | 5166a15378a9c32d9b680417807000ba65d06141 (patch) | |
| tree | bf5b37a04d9bd41128971e7bfd5e1dccef30bb36 /example/help.zig | |
| parent | Refactor parseParam into a state machine (diff) | |
| download | zig-clap-5166a15378a9c32d9b680417807000ba65d06141.tar.gz zig-clap-5166a15378a9c32d9b680417807000ba65d06141.tar.xz zig-clap-5166a15378a9c32d9b680417807000ba65d06141.zip | |
Add parseParams and friends
Diffstat (limited to 'example/help.zig')
| -rw-r--r-- | example/help.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/example/help.zig b/example/help.zig index f3edb58..64d1709 100644 --- a/example/help.zig +++ b/example/help.zig | |||
| @@ -2,10 +2,11 @@ const clap = @import("clap"); | |||
| 2 | const std = @import("std"); | 2 | const std = @import("std"); |
| 3 | 3 | ||
| 4 | pub fn main() !void { | 4 | pub fn main() !void { |
| 5 | const params = comptime [_]clap.Param(clap.Help){ | 5 | const params = comptime clap.parseParamsComptime( |
| 6 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, | 6 | \\-h, --help Display this help and exit. |
| 7 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, | 7 | \\-v, --version Output version information and exit. |
| 8 | }; | 8 | \\ |
| 9 | ); | ||
| 9 | 10 | ||
| 10 | var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{}); | 11 | var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{}); |
| 11 | defer res.deinit(); | 12 | defer res.deinit(); |