From c06c93608cb3befe77c78ba25c70b14db6f7b319 Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Fri, 25 Feb 2022 19:44:52 +0100 Subject: Revert "Change clap into generating a struct" This reverts commit cfaac64c404fb1c2e892880410aa3b7dd881ea58. --- example/usage.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'example/usage.zig') diff --git a/example/usage.zig b/example/usage.zig index 04fedba..368a6b3 100644 --- a/example/usage.zig +++ b/example/usage.zig @@ -3,17 +3,17 @@ const std = @import("std"); pub fn main() !void { const params = comptime [_]clap.Param(clap.Help){ - clap.untyped.parseParam("-h, --help Display this help and exit.") catch unreachable, - clap.untyped.parseParam("-v, --version Output version information and exit.") catch unreachable, - clap.untyped.parseParam(" --value An option parameter, which takes a value.") catch unreachable, + clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, + clap.parseParam("-v, --version Output version information and exit. ") catch unreachable, + clap.parseParam(" --value An option parameter, which takes a value.") catch unreachable, }; - var res = try clap.untyped.parse(clap.Help, ¶ms, .{}); - defer res.deinit(); + var args = try clap.parse(clap.Help, ¶ms, .{}); + defer args.deinit(); // clap.usage is a function that can print a simple usage message, given a // slice of Param(Help). There is also a usageEx, which can print a // usage message for any Param, but it is more verbose to call. - if (res.args.help) + if (args.flag("--help")) return clap.usage(std.io.getStdErr().writer(), ¶ms); } -- cgit v1.2.3