diff options
Diffstat (limited to 'example/simple.zig')
| -rw-r--r-- | example/simple.zig | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/example/simple.zig b/example/simple.zig index 11e975e..1ac7de5 100644 --- a/example/simple.zig +++ b/example/simple.zig | |||
| @@ -6,13 +6,14 @@ const io = std.io; | |||
| 6 | 6 | ||
| 7 | pub fn main() !void { | 7 | pub fn main() !void { |
| 8 | // First we specify what parameters our program can take. | 8 | // First we specify what parameters our program can take. |
| 9 | // We can use `parseParam` to parse a string to a `Param(Help)` | 9 | // We can use `parseParamsComptime` to parse a string into an array of `Param(Help)` |
| 10 | const params = comptime [_]clap.Param(clap.Help){ | 10 | const params = comptime clap.parseParamsComptime( |
| 11 | clap.parseParam("-h, --help Display this help and exit.") catch unreachable, | 11 | \\-h, --help Display this help and exit. |
| 12 | clap.parseParam("-n, --number <usize> An option parameter, which takes a value.") catch unreachable, | 12 | \\-n, --number <usize> An option parameter, which takes a value. |
| 13 | clap.parseParam("-s, --string <str>... An option parameter which can be specified multiple times.") catch unreachable, | 13 | \\-s, --string <str>... An option parameter which can be specified multiple times. |
| 14 | clap.parseParam("<str>...") catch unreachable, | 14 | \\<str>... |
| 15 | }; | 15 | \\ |
| 16 | ); | ||
| 16 | 17 | ||
| 17 | // Initalize our diagnostics, which can be used for reporting useful errors. | 18 | // Initalize our diagnostics, which can be used for reporting useful errors. |
| 18 | // This is optional. You can also pass `.{}` to `clap.parse` if you don't | 19 | // This is optional. You can also pass `.{}` to `clap.parse` if you don't |