summaryrefslogtreecommitdiff
path: root/clap.zig
diff options
context:
space:
mode:
authorGravatar Jimmi Holst Christensen2023-06-27 09:07:17 +0200
committerGravatar Jimmi Holst Christensen2023-06-27 09:07:17 +0200
commitbdb5853b678d68f342ec65b04a6785af522ca6c9 (patch)
treeab95147d2a823b051e72ca73e5085205b882f137 /clap.zig
parentUpdate to latest zig (diff)
downloadzig-clap-bdb5853b678d68f342ec65b04a6785af522ca6c9.tar.gz
zig-clap-bdb5853b678d68f342ec65b04a6785af522ca6c9.tar.xz
zig-clap-bdb5853b678d68f342ec65b04a6785af522ca6c9.zip
Update to latest zig
Diffstat (limited to '')
-rw-r--r--clap.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/clap.zig b/clap.zig
index 420f7c7..bbf7de1 100644
--- a/clap.zig
+++ b/clap.zig
@@ -923,7 +923,7 @@ fn Arguments(
923 fields[i] = .{ 923 fields[i] = .{
924 .name = longest.name, 924 .name = longest.name,
925 .type = @TypeOf(default_value), 925 .type = @TypeOf(default_value),
926 .default_value = @ptrCast(*const anyopaque, &default_value), 926 .default_value = @ptrCast(&default_value),
927 .is_comptime = false, 927 .is_comptime = false,
928 .alignment = @alignOf(@TypeOf(default_value)), 928 .alignment = @alignOf(@TypeOf(default_value)),
929 }; 929 };
@@ -1130,7 +1130,7 @@ pub fn help(
1130 var cs = io.countingWriter(io.null_writer); 1130 var cs = io.countingWriter(io.null_writer);
1131 try printParam(cs.writer(), Id, param); 1131 try printParam(cs.writer(), Id, param);
1132 if (res < cs.bytes_written) 1132 if (res < cs.bytes_written)
1133 res = @intCast(usize, cs.bytes_written); 1133 res = @intCast(cs.bytes_written);
1134 } 1134 }
1135 1135
1136 break :blk res; 1136 break :blk res;
@@ -1155,7 +1155,7 @@ pub fn help(
1155 var description_writer = Writer{ 1155 var description_writer = Writer{
1156 .underlying_writer = writer, 1156 .underlying_writer = writer,
1157 .indentation = description_indentation, 1157 .indentation = description_indentation,
1158 .printed_chars = @intCast(usize, cw.bytes_written), 1158 .printed_chars = @intCast(cw.bytes_written),
1159 .max_width = opt.max_width, 1159 .max_width = opt.max_width,
1160 }; 1160 };
1161 1161
@@ -1746,15 +1746,15 @@ pub fn usage(stream: anytype, comptime Id: type, params: []const Param(Id)) !voi
1746 continue; 1746 continue;
1747 1747
1748 const prefix = if (param.names.short) |_| "-" else "--"; 1748 const prefix = if (param.names.short) |_| "-" else "--";
1749 const name = if (param.names.short) |*s| 1749 const name = blk: {
1750 // Seems the zig compiler is being a little weird. I doesn't allow me to write 1750 if (param.names.short) |*s|
1751 // @as(*const [1]u8, s) 1751 break :blk @as(*const [1]u8, s);
1752 @ptrCast([*]const u8, s)[0..1] 1752 if (param.names.long) |l|
1753 else 1753 break :blk l;
1754 param.names.long orelse { 1754
1755 has_positionals = true; 1755 has_positionals = true;
1756 continue; 1756 continue;
1757 }; 1757 };
1758 1758
1759 if (cos.bytes_written != 0) 1759 if (cos.bytes_written != 0)
1760 try cs.writeAll(" "); 1760 try cs.writeAll(" ");