diff options
Diffstat (limited to 'example/help.zig')
| -rw-r--r-- | example/help.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/example/help.zig b/example/help.zig index 2e7ca2b..de3b707 100644 --- a/example/help.zig +++ b/example/help.zig | |||
| @@ -3,16 +3,16 @@ 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.Param(clap.Help){ |
| 6 | clap.untyped.parseParam("-h, --help Display this help and exit. ") catch unreachable, | 6 | clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, |
| 7 | clap.untyped.parseParam("-v, --version Output version information and exit.") catch unreachable, | 7 | clap.parseParam("-v, --version Output version information and exit.") catch unreachable, |
| 8 | }; | 8 | }; |
| 9 | 9 | ||
| 10 | var res = try clap.untyped.parse(clap.Help, ¶ms, .{}); | 10 | var args = try clap.parse(clap.Help, ¶ms, .{}); |
| 11 | defer res.deinit(); | 11 | defer args.deinit(); |
| 12 | 12 | ||
| 13 | // clap.help is a function that can print a simple help message, given a | 13 | // clap.help is a function that can print a simple help message, given a |
| 14 | // slice of Param(Help). There is also a helpEx, which can print a | 14 | // slice of Param(Help). There is also a helpEx, which can print a |
| 15 | // help message for any Param, but it is more verbose to call. | 15 | // help message for any Param, but it is more verbose to call. |
| 16 | if (res.args.help) | 16 | if (args.flag("--help")) |
| 17 | return clap.help(std.io.getStdErr().writer(), ¶ms); | 17 | return clap.help(std.io.getStdErr().writer(), ¶ms); |
| 18 | } | 18 | } |