summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md9
1 files changed, 5 insertions, 4 deletions
diff --git a/README.md b/README.md
index bbf61e5..f5018fc 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@ in the release notes.
14 14
15* Short arguments `-a` 15* Short arguments `-a`
16 * Chaining `-abc` where `a` and `b` does not take values. 16 * Chaining `-abc` where `a` and `b` does not take values.
17 * Multiple specifications are tallied (e.g. `-v -v`).
17* Long arguments `--long` 18* Long arguments `--long`
18* Supports both passing values using spacing and `=` (`-a 100`, `-a=100`) 19* Supports both passing values using spacing and `=` (`-a 100`, `-a=100`)
19 * Short args also support passing values with no spacing or `=` (`-a100`) 20 * Short args also support passing values with no spacing or `=` (`-a100`)
@@ -59,7 +60,7 @@ pub fn main() !void {
59 }; 60 };
60 defer res.deinit(); 61 defer res.deinit();
61 62
62 if (res.args.help) 63 if (res.args.help != 0)
63 debug.print("--help\n", .{}); 64 debug.print("--help\n", .{});
64 if (res.args.number) |n| 65 if (res.args.number) |n|
65 debug.print("--number = {}\n", .{n}); 66 debug.print("--number = {}\n", .{n});
@@ -121,7 +122,7 @@ pub fn main() !void {
121 }; 122 };
122 defer res.deinit(); 123 defer res.deinit();
123 124
124 if (res.args.help) 125 if (res.args.help != 0)
125 debug.print("--help\n", .{}); 126 debug.print("--help\n", .{});
126 if (res.args.number) |n| 127 if (res.args.number) |n|
127 debug.print("--number = {}\n", .{n}); 128 debug.print("--number = {}\n", .{n});
@@ -231,7 +232,7 @@ pub fn main() !void {
231 // where `Id` has a `describtion` and `value` method (`Param(Help)` is one such parameter). 232 // where `Id` has a `describtion` and `value` method (`Param(Help)` is one such parameter).
232 // The last argument contains options as to how `help` should print those parameters. Using 233 // The last argument contains options as to how `help` should print those parameters. Using
233 // `.{}` means the default options. 234 // `.{}` means the default options.
234 if (res.args.help) 235 if (res.args.help != 0)
235 return clap.help(std.io.getStdErr().writer(), clap.Help, &params, .{}); 236 return clap.help(std.io.getStdErr().writer(), clap.Help, &params, .{});
236} 237}
237 238
@@ -268,7 +269,7 @@ pub fn main() !void {
268 269
269 // `clap.usage` is a function that can print a simple help message. It can print any `Param` 270 // `clap.usage` is a function that can print a simple help message. It can print any `Param`
270 // where `Id` has a `value` method (`Param(Help)` is one such parameter). 271 // where `Id` has a `value` method (`Param(Help)` is one such parameter).
271 if (res.args.help) 272 if (res.args.help != 0)
272 return clap.usage(std.io.getStdErr().writer(), clap.Help, &params); 273 return clap.usage(std.io.getStdErr().writer(), clap.Help, &params);
273} 274}
274 275