From a3d2a261f59983838e3ed5f01d90f18352e6a421 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Fri, 28 Aug 2020 17:26:01 +1000 Subject: adjust examples, README template --- example/simple.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'example/simple.zig') diff --git a/example/simple.zig b/example/simple.zig index 3510317..adea9f9 100644 --- a/example/simple.zig +++ b/example/simple.zig @@ -7,10 +7,11 @@ pub fn main() !void { // First we specify what parameters our program can take. // We can use `parseParam` to parse a string to a `Param(Help)` const params = comptime [_]clap.Param(clap.Help){ - clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, - clap.parseParam("-n, --number An option parameter, which takes a value.") catch unreachable, + clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, + clap.parseParam("-n, --number An option parameter, which takes a value.") catch unreachable, + clap.parseParam("-s, --string ... An option parameter which can be specified multiple times.") catch unreachable, clap.Param(clap.Help){ - .takes_value = true, + .takes_value = .One, }, }; @@ -21,6 +22,8 @@ pub fn main() !void { debug.warn("--help\n", .{}); if (args.option("--number")) |n| debug.warn("--number = {}\n", .{n}); + for (args.options("--string")) |s| + debug.warn("--string = {}\n", .{s}); for (args.positionals()) |pos| debug.warn("{}\n", .{pos}); } -- cgit v1.2.3