From 7399ee309e960733c3f6701eba685fbe284365cf Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Sat, 17 Aug 2019 15:21:45 +0200 Subject: adds parseParam a less verbose way of getting a Param(Help). --- example/help.zig | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'example/help.zig') diff --git a/example/help.zig b/example/help.zig index 35c0258..de8a55a 100644 --- a/example/help.zig +++ b/example/help.zig @@ -7,19 +7,13 @@ pub fn main() !void { const stderr = &stderr_out_stream.stream; // clap.help is a function that can print a simple help message, given a - // slice of Param([]const u8). There is also a helpEx, which can print 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. try clap.help( stderr, - [_]clap.Param([]const u8){ - clap.Param([]const u8){ - .id = "Display this help and exit.", - .names = clap.Names{ .short = 'h', .long = "help" }, - }, - clap.Param([]const u8){ - .id = "Output version information and exit.", - .names = clap.Names{ .short = 'v', .long = "version" }, - }, + comptime [_]clap.Param(clap.Help){ + clap.parseParam("-h, --help Display this help and exit. ") catch unreachable, + clap.parseParam("-v, --version Output version information and exit.") catch unreachable, }, ); } -- cgit v1.2.3