summaryrefslogtreecommitdiff
path: root/example/simple-ex.zig
diff options
context:
space:
mode:
authorGravatar Jimmi Holst Christensen2022-03-23 20:05:28 +0100
committerGravatar Komari Spaghetti2022-03-23 21:48:20 +0100
commit5166a15378a9c32d9b680417807000ba65d06141 (patch)
treebf5b37a04d9bd41128971e7bfd5e1dccef30bb36 /example/simple-ex.zig
parentRefactor parseParam into a state machine (diff)
downloadzig-clap-5166a15378a9c32d9b680417807000ba65d06141.tar.gz
zig-clap-5166a15378a9c32d9b680417807000ba65d06141.tar.xz
zig-clap-5166a15378a9c32d9b680417807000ba65d06141.zip
Add parseParams and friends
Diffstat (limited to 'example/simple-ex.zig')
-rw-r--r--example/simple-ex.zig15
1 files changed, 8 insertions, 7 deletions
diff --git a/example/simple-ex.zig b/example/simple-ex.zig
index 6cb4c3f..d0d214d 100644
--- a/example/simple-ex.zig
+++ b/example/simple-ex.zig
@@ -7,13 +7,14 @@ const process = std.process;
7 7
8pub fn main() !void { 8pub fn main() !void {
9 // First we specify what parameters our program can take. 9 // First we specify what parameters our program can take.
10 // We can use `parseParam` to parse a string to a `Param(Help)` 10 // We can use `parseParamsComptime` to parse a string into an array of `Param(Help)`
11 const params = comptime [_]clap.Param(clap.Help){ 11 const params = comptime clap.parseParamsComptime(
12 clap.parseParam("-h, --help Display this help and exit.") catch unreachable, 12 \\-h, --help Display this help and exit.
13 clap.parseParam("-n, --number <INT> An option parameter, which takes a value.") catch unreachable, 13 \\-n, --number <INT> An option parameter, which takes a value.
14 clap.parseParam("-s, --string <STR>... An option parameter which can be specified multiple times.") catch unreachable, 14 \\-s, --string <STR>... An option parameter which can be specified multiple times.
15 clap.parseParam("<FILE>...") catch unreachable, 15 \\<FILE>...
16 }; 16 \\
17 );
17 18
18 // Declare our own parsers which are used to map the argument strings to other 19 // Declare our own parsers which are used to map the argument strings to other
19 // types. 20 // types.