summaryrefslogtreecommitdiff
path: root/example/usage.zig
diff options
context:
space:
mode:
authorGravatar Jimmi Holst Christensen2022-02-25 19:44:52 +0100
committerGravatar Jimmi Holst Christensen2022-02-25 19:44:52 +0100
commitc06c93608cb3befe77c78ba25c70b14db6f7b319 (patch)
tree3598bbd00512eb5baa6da004ae7e42cd8005c3eb /example/usage.zig
parentChange clap into generating a struct (diff)
downloadzig-clap-c06c93608cb3befe77c78ba25c70b14db6f7b319.tar.gz
zig-clap-c06c93608cb3befe77c78ba25c70b14db6f7b319.tar.xz
zig-clap-c06c93608cb3befe77c78ba25c70b14db6f7b319.zip
Revert "Change clap into generating a struct"
This reverts commit cfaac64c404fb1c2e892880410aa3b7dd881ea58.
Diffstat (limited to '')
-rw-r--r--example/usage.zig12
1 files changed, 6 insertions, 6 deletions
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");
3 3
4pub fn main() !void { 4pub 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 clap.untyped.parseParam(" --value <N> An option parameter, which takes a value.") catch unreachable, 8 clap.parseParam(" --value <N> An option parameter, which takes a value.") catch unreachable,
9 }; 9 };
10 10
11 var res = try clap.untyped.parse(clap.Help, &params, .{}); 11 var args = try clap.parse(clap.Help, &params, .{});
12 defer res.deinit(); 12 defer args.deinit();
13 13
14 // clap.usage is a function that can print a simple usage message, given a 14 // clap.usage is a function that can print a simple usage message, given a
15 // slice of Param(Help). There is also a usageEx, which can print a 15 // slice of Param(Help). There is also a usageEx, which can print a
16 // usage message for any Param, but it is more verbose to call. 16 // usage message for any Param, but it is more verbose to call.
17 if (res.args.help) 17 if (args.flag("--help"))
18 return clap.usage(std.io.getStdErr().writer(), &params); 18 return clap.usage(std.io.getStdErr().writer(), &params);
19} 19}