summaryrefslogtreecommitdiff
path: root/example/usage.zig
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--example/usage.zig13
1 files changed, 4 insertions, 9 deletions
diff --git a/example/usage.zig b/example/usage.zig
index 8bd25b7..b7308f5 100644
--- a/example/usage.zig
+++ b/example/usage.zig
@@ -14,15 +14,10 @@ pub fn main() !void {
14 }); 14 });
15 defer res.deinit(); 15 defer res.deinit();
16 16
17 // `clap.usage` is a function that can print a simple help message. It can print any `Param` 17 // `clap.usageToFile` is a function that can print a simple usage string. It can print any
18 // where `Id` has a `value` method (`Param(Help)` is one such parameter). 18 // `Param` where `Id` has a `value` method (`Param(Help)` is one such parameter).
19 if (res.args.help != 0) { 19 if (res.args.help != 0)
20 var buf: [1024]u8 = undefined; 20 return clap.usageToFile(.stdout(), clap.Help, &params);
21 var stderr = std.fs.File.stderr().writer(&buf);
22 clap.usage(&stderr.interface, clap.Help, &params) catch {};
23 try stderr.interface.flush();
24 return;
25 }
26} 21}
27 22
28const clap = @import("clap"); 23const clap = @import("clap");