diff options
| author | 2026-01-02 20:59:20 +0900 | |
|---|---|---|
| committer | 2026-01-02 20:59:20 +0900 | |
| commit | 3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe (patch) | |
| tree | 71b3c0023650979eceee27bc37f507d2e73a7e17 /example/help.zig | |
| parent | hotfix: replace deprecated std.fs.File with std.Io.File for Zig v0.16 (diff) | |
| download | zig-clap-3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe.tar.gz zig-clap-3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe.tar.xz zig-clap-3c35ff18bb32fec2f53e12e6bdbb00422d6c33fe.zip | |
chore: update examples to use std.Io for Zig v0.16 compatibility
Signed-off-by: Takumi Katase <takumi.katase@devoc.ninja>
Diffstat (limited to 'example/help.zig')
| -rw-r--r-- | example/help.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/example/help.zig b/example/help.zig index d8e8f12..a4379de 100644 --- a/example/help.zig +++ b/example/help.zig | |||
| @@ -13,12 +13,14 @@ pub fn main() !void { | |||
| 13 | }); | 13 | }); |
| 14 | defer res.deinit(); | 14 | defer res.deinit(); |
| 15 | 15 | ||
| 16 | var threaded: std.Io.Threaded = .init_single_threaded; | ||
| 17 | const io: std.Io = threaded.io(); | ||
| 16 | // `clap.help` is a function that can print a simple help message. It can print any `Param` | 18 | // `clap.help` is a function that can print a simple help message. It can print any `Param` |
| 17 | // where `Id` has a `description` and `value` method (`Param(Help)` is one such parameter). | 19 | // where `Id` has a `description` and `value` method (`Param(Help)` is one such parameter). |
| 18 | // The last argument contains options as to how `help` should print those parameters. Using | 20 | // The last argument contains options as to how `help` should print those parameters. Using |
| 19 | // `.{}` means the default options. | 21 | // `.{}` means the default options. |
| 20 | if (res.args.help != 0) | 22 | if (res.args.help != 0) |
| 21 | return clap.helpToFile(.stderr(), clap.Help, ¶ms, .{}); | 23 | return clap.helpToFile(io, .stderr(), clap.Help, ¶ms, .{}); |
| 22 | } | 24 | } |
| 23 | 25 | ||
| 24 | const clap = @import("clap"); | 26 | const clap = @import("clap"); |