diff options
| author | 2026-01-01 02:58:41 +0900 | |
|---|---|---|
| committer | 2026-01-01 05:06:11 +0900 | |
| commit | ed8209333358dba0bb9ccc5dfbb2ab3df1741742 (patch) | |
| tree | 4a7790e457ab91e32b4ae6a7e59ccb134b0952e4 /clap.zig | |
| parent | hotfix: replace deprecated std.mem.trimLeft with trimStart for Zig 0.16 (diff) | |
| download | zig-clap-ed8209333358dba0bb9ccc5dfbb2ab3df1741742.tar.gz zig-clap-ed8209333358dba0bb9ccc5dfbb2ab3df1741742.tar.xz zig-clap-ed8209333358dba0bb9ccc5dfbb2ab3df1741742.zip | |
hotfix: replace deprecated std.fs.File with std.Io.File for Zig v0.16
Signed-off-by: Takumi Katase <takumi.katase@devoc.ninja>
Diffstat (limited to 'clap.zig')
| -rw-r--r-- | clap.zig | 13 |
1 files changed, 7 insertions, 6 deletions
| @@ -562,9 +562,9 @@ pub const Diagnostic = struct { | |||
| 562 | } | 562 | } |
| 563 | 563 | ||
| 564 | /// Wrapper around `report`, which writes to a file in a buffered manner | 564 | /// Wrapper around `report`, which writes to a file in a buffered manner |
| 565 | pub fn reportToFile(diag: Diagnostic, file: std.fs.File, err: anyerror) !void { | 565 | pub fn reportToFile(diag: Diagnostic, io: std.Io, file: std.Io.File, err: anyerror) !void { |
| 566 | var buf: [1024]u8 = undefined; | 566 | var buf: [1024]u8 = undefined; |
| 567 | var writer = file.writer(&buf); | 567 | var writer = file.writer(io, &buf); |
| 568 | try diag.report(&writer.interface, err); | 568 | try diag.report(&writer.interface, err); |
| 569 | return writer.interface.flush(); | 569 | return writer.interface.flush(); |
| 570 | } | 570 | } |
| @@ -1358,13 +1358,14 @@ pub const HelpOptions = struct { | |||
| 1358 | 1358 | ||
| 1359 | /// Wrapper around `help`, which writes to a file in a buffered manner | 1359 | /// Wrapper around `help`, which writes to a file in a buffered manner |
| 1360 | pub fn helpToFile( | 1360 | pub fn helpToFile( |
| 1361 | file: std.fs.File, | 1361 | io: std.Io, |
| 1362 | file: std.Io.File, | ||
| 1362 | comptime Id: type, | 1363 | comptime Id: type, |
| 1363 | params: []const Param(Id), | 1364 | params: []const Param(Id), |
| 1364 | opt: HelpOptions, | 1365 | opt: HelpOptions, |
| 1365 | ) !void { | 1366 | ) !void { |
| 1366 | var buf: [1024]u8 = undefined; | 1367 | var buf: [1024]u8 = undefined; |
| 1367 | var writer = file.writer(&buf); | 1368 | var writer = file.writer(io, &buf); |
| 1368 | try help(&writer.interface, Id, params, opt); | 1369 | try help(&writer.interface, Id, params, opt); |
| 1369 | return writer.interface.flush(); | 1370 | return writer.interface.flush(); |
| 1370 | } | 1371 | } |
| @@ -2017,9 +2018,9 @@ test "clap.help" { | |||
| 2017 | } | 2018 | } |
| 2018 | 2019 | ||
| 2019 | /// Wrapper around `usage`, which writes to a file in a buffered manner | 2020 | /// Wrapper around `usage`, which writes to a file in a buffered manner |
| 2020 | pub fn usageToFile(file: std.fs.File, comptime Id: type, params: []const Param(Id)) !void { | 2021 | pub fn usageToFile(io: std.Io, file: std.Io.File, comptime Id: type, params: []const Param(Id)) !void { |
| 2021 | var buf: [1024]u8 = undefined; | 2022 | var buf: [1024]u8 = undefined; |
| 2022 | var writer = file.writer(&buf); | 2023 | var writer = file.writer(io, &buf); |
| 2023 | try usage(&writer.interface, Id, params); | 2024 | try usage(&writer.interface, Id, params); |
| 2024 | return writer.interface.flush(); | 2025 | return writer.interface.flush(); |
| 2025 | } | 2026 | } |