From 5f7b75d5523d9581eca5a72a362868ff517992e8 Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Fri, 25 Feb 2022 19:40:00 +0100 Subject: Allow for clap to parse argument values into types This changes - `.flag`, `.option`, `.options` and `.positionals` are now just fields you access on the result of `parse` and `parseEx`. - `clap.ComptimeClap` has been removed. - `clap.StreamingClap` is now called `clap.streaming.Clap` - `parse` and `parseEx` now takes a `value_parsers` argument that provides the parsers to parse values. - Remove `helpEx`, `helpFull`, `usageEx` and `usageFull`. They now just expect `Id` to have methods for getting the description and value texts. --- example/help.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'example/help.zig') diff --git a/example/help.zig b/example/help.zig index de3b707..f3edb58 100644 --- a/example/help.zig +++ b/example/help.zig @@ -7,12 +7,12 @@ pub fn main() !void { clap.parseParam("-v, --version Output version information and exit.") catch unreachable, }; - var args = try clap.parse(clap.Help, ¶ms, .{}); - defer args.deinit(); + var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{}); + defer res.deinit(); // clap.help is a function that can print a simple help message, given a // slice of Param(Help). There is also a helpEx, which can print a // help message for any Param, but it is more verbose to call. - if (args.flag("--help")) - return clap.help(std.io.getStdErr().writer(), ¶ms); + if (res.args.help) + return clap.help(std.io.getStdErr().writer(), clap.Help, ¶ms); } -- cgit v1.2.3