summaryrefslogtreecommitdiff
path: root/clap.zig
diff options
context:
space:
mode:
authorGravatar joachimschmidt5572020-04-11 11:44:58 +0200
committerGravatar joachimschmidt5572020-04-11 11:44:58 +0200
commit5fe26bb6ee767490a39f18eec84c19464931bf98 (patch)
treedd15e152a99492063f1c09fdc51dabbb2dc67d72 /clap.zig
parentMerge pull request #15 from dbandstra/zig-master (diff)
downloadzig-clap-5fe26bb6ee767490a39f18eec84c19464931bf98.tar.gz
zig-clap-5fe26bb6ee767490a39f18eec84c19464931bf98.tar.xz
zig-clap-5fe26bb6ee767490a39f18eec84c19464931bf98.zip
update to latest zig
Diffstat (limited to 'clap.zig')
-rw-r--r--clap.zig14
1 files changed, 8 insertions, 6 deletions
diff --git a/clap.zig b/clap.zig
index 3d5b60b..6ef00a4 100644
--- a/clap.zig
+++ b/clap.zig
@@ -282,8 +282,8 @@ pub fn helpFull(
282 const max_spacing = blk: { 282 const max_spacing = blk: {
283 var res: usize = 0; 283 var res: usize = 0;
284 for (params) |param| { 284 for (params) |param| {
285 var counting_stream = io.CountingOutStream(io.NullOutStream.Error).init(io.null_out_stream); 285 var counting_stream = io.countingOutStream(io.null_out_stream);
286 try printParam(&counting_stream.stream, Id, param, Error, context, value_text); 286 try printParam(&counting_stream.outStream(), Id, param, Error, context, value_text);
287 if (res < counting_stream.bytes_written) 287 if (res < counting_stream.bytes_written)
288 res = counting_stream.bytes_written; 288 res = counting_stream.bytes_written;
289 } 289 }
@@ -295,9 +295,9 @@ pub fn helpFull(
295 if (param.names.short == null and param.names.long == null) 295 if (param.names.short == null and param.names.long == null)
296 continue; 296 continue;
297 297
298 var counting_stream = io.CountingOutStream(@TypeOf(stream.*).Error).init(stream); 298 var counting_stream = io.countingOutStream(stream);
299 try stream.print("\t", .{}); 299 try stream.print("\t", .{});
300 try printParam(&counting_stream.stream, Id, param, Error, context, value_text); 300 try printParam(&counting_stream.outStream(), Id, param, Error, context, value_text);
301 try stream.writeByteNTimes(' ', max_spacing - counting_stream.bytes_written); 301 try stream.writeByteNTimes(' ', max_spacing - counting_stream.bytes_written);
302 try stream.print("\t{}\n", .{ try help_text(context, param) }); 302 try stream.print("\t{}\n", .{ try help_text(context, param) });
303 } 303 }
@@ -385,9 +385,11 @@ fn getValueSimple(param: Param(Help)) []const u8 {
385 385
386test "clap.help" { 386test "clap.help" {
387 var buf: [1024]u8 = undefined; 387 var buf: [1024]u8 = undefined;
388 var slice_stream = io.SliceOutStream.init(buf[0..]); 388 var slice_stream = io.fixedBufferStream(&buf);
389
390 @setEvalBranchQuota(10000);
389 try help( 391 try help(
390 &slice_stream.stream, 392 slice_stream.outStream(),
391 comptime &[_]Param(Help){ 393 comptime &[_]Param(Help){
392 parseParam("-a Short flag. ") catch unreachable, 394 parseParam("-a Short flag. ") catch unreachable,
393 parseParam("-b <V1> Short option.") catch unreachable, 395 parseParam("-b <V1> Short option.") catch unreachable,