diff options
| author | 2022-03-23 20:05:28 +0100 | |
|---|---|---|
| committer | 2022-03-23 21:48:20 +0100 | |
| commit | 5166a15378a9c32d9b680417807000ba65d06141 (patch) | |
| tree | bf5b37a04d9bd41128971e7bfd5e1dccef30bb36 /example/usage.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 '')
| -rw-r--r-- | example/usage.zig | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/example/usage.zig b/example/usage.zig index 20d4736..f57b07c 100644 --- a/example/usage.zig +++ b/example/usage.zig | |||
| @@ -2,11 +2,12 @@ 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 | clap.parseParam(" --value <str> An option parameter, which takes a value.") catch unreachable, | 8 | \\ --value <str> An option parameter, which takes a value. |
| 9 | }; | 9 | \\ |
| 10 | ); | ||
| 10 | 11 | ||
| 11 | var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{}); | 12 | var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{}); |
| 12 | defer res.deinit(); | 13 | defer res.deinit(); |