diff options
Diffstat (limited to 'example/usage.zig')
| -rw-r--r-- | example/usage.zig | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/example/usage.zig b/example/usage.zig index 59ac84a..8bd25b7 100644 --- a/example/usage.zig +++ b/example/usage.zig | |||
| @@ -16,8 +16,13 @@ pub fn main() !void { | |||
| 16 | 16 | ||
| 17 | // `clap.usage` is a function that can print a simple help message. It can print any `Param` | 17 | // `clap.usage` is a function that can print a simple help message. It can print any `Param` |
| 18 | // where `Id` has a `value` method (`Param(Help)` is one such parameter). | 18 | // 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 | return clap.usage(std.io.getStdErr().writer(), clap.Help, ¶ms); | 20 | var buf: [1024]u8 = undefined; |
| 21 | var stderr = std.fs.File.stderr().writer(&buf); | ||
| 22 | clap.usage(&stderr.interface, clap.Help, ¶ms) catch {}; | ||
| 23 | try stderr.interface.flush(); | ||
| 24 | return; | ||
| 25 | } | ||
| 21 | } | 26 | } |
| 22 | 27 | ||
| 23 | const clap = @import("clap"); | 28 | const clap = @import("clap"); |