diff options
Diffstat (limited to 'example/simple-ex.zig')
| -rw-r--r-- | example/simple-ex.zig | 15 |
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 | ||
| 8 | pub fn main() !void { | 8 | pub 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. |