diff options
| author | 2019-08-17 15:21:45 +0200 | |
|---|---|---|
| committer | 2019-08-17 15:21:45 +0200 | |
| commit | 7399ee309e960733c3f6701eba685fbe284365cf (patch) | |
| tree | cb061d7d326a2a5385ecec2dc5bd0d11fa7a4d34 /example/help.zig | |
| parent | build with latest version of zig (diff) | |
| download | zig-clap-7399ee309e960733c3f6701eba685fbe284365cf.tar.gz zig-clap-7399ee309e960733c3f6701eba685fbe284365cf.tar.xz zig-clap-7399ee309e960733c3f6701eba685fbe284365cf.zip | |
adds parseParam
a less verbose way of getting a Param(Help).
Diffstat (limited to 'example/help.zig')
| -rw-r--r-- | example/help.zig | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/example/help.zig b/example/help.zig index 35c0258..de8a55a 100644 --- a/example/help.zig +++ b/example/help.zig | |||
| @@ -7,19 +7,13 @@ pub fn main() !void { | |||
| 7 | const stderr = &stderr_out_stream.stream; | 7 | const stderr = &stderr_out_stream.stream; |
| 8 | 8 | ||
| 9 | // clap.help is a function that can print a simple help message, given a | 9 | // clap.help is a function that can print a simple help message, given a |
| 10 | // slice of Param([]const u8). There is also a helpEx, which can print a | 10 | // slice of Param(Help). There is also a helpEx, which can print a |
| 11 | // help message for any Param, but it is more verbose to call. | 11 | // help message for any Param, but it is more verbose to call. |
| 12 | try clap.help( | 12 | try clap.help( |
| 13 | stderr, | 13 | stderr, |
| 14 | [_]clap.Param([]const u8){ | 14 | comptime [_]clap.Param(clap.Help){ |
| 15 | clap.Param([]const u8){ | 15 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, |
| 16 | .id = "Display this help and exit.", | 16 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, |
| 17 | .names = clap.Names{ .short = 'h', .long = "help" }, | ||
| 18 | }, | ||
| 19 | clap.Param([]const u8){ | ||
| 20 | .id = "Output version information and exit.", | ||
| 21 | .names = clap.Names{ .short = 'v', .long = "version" }, | ||
| 22 | }, | ||
| 23 | }, | 17 | }, |
| 24 | ); | 18 | ); |
| 25 | } | 19 | } |