diff options
Diffstat (limited to 'clap.zig')
| -rw-r--r-- | clap.zig | 32 |
1 files changed, 16 insertions, 16 deletions
| @@ -296,10 +296,10 @@ pub fn helpFull( | |||
| 296 | continue; | 296 | continue; |
| 297 | 297 | ||
| 298 | var counting_stream = io.CountingOutStream(@typeOf(stream.*).Error).init(stream); | 298 | var counting_stream = io.CountingOutStream(@typeOf(stream.*).Error).init(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.stream, 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 | } |
| 304 | } | 304 | } |
| 305 | 305 | ||
| @@ -312,21 +312,21 @@ fn printParam( | |||
| 312 | value_text: fn (@typeOf(context), Param(Id)) Error![]const u8, | 312 | value_text: fn (@typeOf(context), Param(Id)) Error![]const u8, |
| 313 | ) @typeOf(stream.*).Error!void { | 313 | ) @typeOf(stream.*).Error!void { |
| 314 | if (param.names.short) |s| { | 314 | if (param.names.short) |s| { |
| 315 | try stream.print("-{c}", s); | 315 | try stream.print("-{c}", .{ s }); |
| 316 | } else { | 316 | } else { |
| 317 | try stream.print(" "); | 317 | try stream.print(" ", .{}); |
| 318 | } | 318 | } |
| 319 | if (param.names.long) |l| { | 319 | if (param.names.long) |l| { |
| 320 | if (param.names.short) |_| { | 320 | if (param.names.short) |_| { |
| 321 | try stream.print(", "); | 321 | try stream.print(", ", .{}); |
| 322 | } else { | 322 | } else { |
| 323 | try stream.print(" "); | 323 | try stream.print(" ", .{}); |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | try stream.print("--{}", l); | 326 | try stream.print("--{}", .{ l }); |
| 327 | } | 327 | } |
| 328 | if (param.takes_value) | 328 | if (param.takes_value) |
| 329 | try stream.print(" <{}>", value_text(context, param)); | 329 | try stream.print(" <{}>", .{ value_text(context, param) }); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | /// A wrapper around helpFull for simple help_text and value_text functions that | 332 | /// A wrapper around helpFull for simple help_text and value_text functions that |
| @@ -414,18 +414,18 @@ test "clap.help" { | |||
| 414 | 414 | ||
| 415 | const actual = slice_stream.getWritten(); | 415 | const actual = slice_stream.getWritten(); |
| 416 | if (!mem.eql(u8, actual, expected)) { | 416 | if (!mem.eql(u8, actual, expected)) { |
| 417 | debug.warn("\n============ Expected ============\n"); | 417 | debug.warn("\n============ Expected ============\n", .{}); |
| 418 | debug.warn("{}", expected); | 418 | debug.warn("{}", .{ expected }); |
| 419 | debug.warn("============= Actual =============\n"); | 419 | debug.warn("============= Actual =============\n", .{}); |
| 420 | debug.warn("{}", actual); | 420 | debug.warn("{}", .{ actual }); |
| 421 | 421 | ||
| 422 | var buffer: [1024 * 2]u8 = undefined; | 422 | var buffer: [1024 * 2]u8 = undefined; |
| 423 | var fba = std.heap.FixedBufferAllocator.init(&buffer); | 423 | var fba = std.heap.FixedBufferAllocator.init(&buffer); |
| 424 | 424 | ||
| 425 | debug.warn("============ Expected (escaped) ============\n"); | 425 | debug.warn("============ Expected (escaped) ============\n", .{}); |
| 426 | debug.warn("{x}\n", expected); | 426 | debug.warn("{x}\n", .{ expected }); |
| 427 | debug.warn("============ Actual (escaped) ============\n"); | 427 | debug.warn("============ Actual (escaped) ============\n", .{}); |
| 428 | debug.warn("{x}\n", actual); | 428 | debug.warn("{x}\n", .{ actual }); |
| 429 | testing.expect(false); | 429 | testing.expect(false); |
| 430 | } | 430 | } |
| 431 | } | 431 | } |