From ac5f46541ca47d3db9df0fcef3cc61731adaefab Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Wed, 30 Mar 2022 22:04:15 +0200 Subject: Update help and usage examples --- README.md | 12 ++++++------ example/help.zig | 7 ++++--- example/usage.zig | 5 ++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 25199e2..56d41c7 100644 --- a/README.md +++ b/README.md @@ -217,9 +217,10 @@ pub fn main() !void { 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. + // `clap.help` is a function that can print a simple help message. It can print any `Param` + // where `Id` has a `describtion` and `value` method (`Param(Help)` is one such parameter). + // The last argument contains options as to how `help` should print those parameters. Using + // `.{}` means the default options. if (res.args.help) return clap.help(std.io.getStdErr().writer(), clap.Help, ¶ms, .{}); } @@ -255,9 +256,8 @@ pub fn main() !void { var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{}); defer res.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. + // `clap.usage` is a function that can print a simple help message. It can print any `Param` + // where `Id` has a `value` method (`Param(Help)` is one such parameter). if (res.args.help) return clap.usage(std.io.getStdErr().writer(), clap.Help, ¶ms); } diff --git a/example/help.zig b/example/help.zig index 18d61b9..dd9c9ea 100644 --- a/example/help.zig +++ b/example/help.zig @@ -11,9 +11,10 @@ pub fn main() !void { 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. + // `clap.help` is a function that can print a simple help message. It can print any `Param` + // where `Id` has a `describtion` and `value` method (`Param(Help)` is one such parameter). + // The last argument contains options as to how `help` should print those parameters. Using + // `.{}` means the default options. if (res.args.help) return clap.help(std.io.getStdErr().writer(), clap.Help, ¶ms, .{}); } diff --git a/example/usage.zig b/example/usage.zig index f57b07c..0d21352 100644 --- a/example/usage.zig +++ b/example/usage.zig @@ -12,9 +12,8 @@ pub fn main() !void { var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{}); defer res.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. + // `clap.usage` is a function that can print a simple help message. It can print any `Param` + // where `Id` has a `value` method (`Param(Help)` is one such parameter). if (res.args.help) return clap.usage(std.io.getStdErr().writer(), clap.Help, ¶ms); } -- cgit v1.2.3