summaryrefslogtreecommitdiff
path: root/clap.zig
diff options
context:
space:
mode:
Diffstat (limited to 'clap.zig')
-rw-r--r--clap.zig28
1 files changed, 14 insertions, 14 deletions
diff --git a/clap.zig b/clap.zig
index 49d0670..8d721fa 100644
--- a/clap.zig
+++ b/clap.zig
@@ -219,10 +219,10 @@ pub const Diagnostic = struct {
219 Arg{ .prefix = "", .name = diag.arg }; 219 Arg{ .prefix = "", .name = diag.arg };
220 220
221 switch (err) { 221 switch (err) {
222 error.DoesntTakeValue => try stream.print("The argument '{}{}' does not take a value\n", .{ a.prefix, a.name }), 222 error.DoesntTakeValue => try stream.print("The argument '{s}{s}' does not take a value\n", .{ a.prefix, a.name }),
223 error.MissingValue => try stream.print("The argument '{}{}' requires a value but none was supplied\n", .{ a.prefix, a.name }), 223 error.MissingValue => try stream.print("The argument '{s}{s}' requires a value but none was supplied\n", .{ a.prefix, a.name }),
224 error.InvalidArgument => try stream.print("Invalid argument '{}{}'\n", .{ a.prefix, a.name }), 224 error.InvalidArgument => try stream.print("Invalid argument '{s}{s}'\n", .{ a.prefix, a.name }),
225 else => try stream.print("Error while parsing arguments: {}\n", .{@errorName(err)}), 225 else => try stream.print("Error while parsing arguments: {s}\n", .{@errorName(err)}),
226 } 226 }
227 } 227 }
228}; 228};
@@ -338,7 +338,7 @@ pub fn helpFull(
338 const max_spacing = blk: { 338 const max_spacing = blk: {
339 var res: usize = 0; 339 var res: usize = 0;
340 for (params) |param| { 340 for (params) |param| {
341 var cs = io.countingOutStream(io.null_out_stream); 341 var cs = io.countingOutStream(io.null_writer);
342 try printParam(cs.writer(), Id, param, Error, context, valueText); 342 try printParam(cs.writer(), Id, param, Error, context, valueText);
343 if (res < cs.bytes_written) 343 if (res < cs.bytes_written)
344 res = @intCast(usize, cs.bytes_written); 344 res = @intCast(usize, cs.bytes_written);
@@ -351,7 +351,7 @@ pub fn helpFull(
351 if (param.names.short == null and param.names.long == null) 351 if (param.names.short == null and param.names.long == null)
352 continue; 352 continue;
353 353
354 var cs = io.countingOutStream(stream); 354 var cs = io.countingWriter(stream);
355 try stream.print("\t", .{}); 355 try stream.print("\t", .{});
356 try printParam(cs.writer(), Id, param, Error, context, valueText); 356 try printParam(cs.writer(), Id, param, Error, context, valueText);
357 try stream.writeByteNTimes(' ', max_spacing - @intCast(usize, cs.bytes_written)); 357 try stream.writeByteNTimes(' ', max_spacing - @intCast(usize, cs.bytes_written));
@@ -379,13 +379,13 @@ fn printParam(
379 try stream.print(" ", .{}); 379 try stream.print(" ", .{});
380 } 380 }
381 381
382 try stream.print("--{}", .{l}); 382 try stream.print("--{s}", .{l});
383 } 383 }
384 384
385 switch (param.takes_value) { 385 switch (param.takes_value) {
386 .none => {}, 386 .none => {},
387 .one => try stream.print(" <{}>", .{valueText(context, param)}), 387 .one => try stream.print(" <{s}>", .{valueText(context, param)}),
388 .many => try stream.print(" <{}>...", .{valueText(context, param)}), 388 .many => try stream.print(" <{s}>...", .{valueText(context, param)}),
389 } 389 }
390} 390}
391 391
@@ -487,7 +487,7 @@ pub fn usageFull(
487 context: anytype, 487 context: anytype,
488 valueText: fn (@TypeOf(context), Param(Id)) Error![]const u8, 488 valueText: fn (@TypeOf(context), Param(Id)) Error![]const u8,
489) !void { 489) !void {
490 var cos = io.countingOutStream(stream); 490 var cos = io.countingWriter(stream);
491 const cs = cos.writer(); 491 const cs = cos.writer();
492 for (params) |param| { 492 for (params) |param| {
493 const name = param.names.short orelse continue; 493 const name = param.names.short orelse continue;
@@ -517,11 +517,11 @@ pub fn usageFull(
517 if (cos.bytes_written != 0) 517 if (cos.bytes_written != 0)
518 try cs.writeByte(' '); 518 try cs.writeByte(' ');
519 519
520 try cs.print("[{}{}", .{ prefix, name }); 520 try cs.print("[{s}{s}", .{ prefix, name });
521 switch (param.takes_value) { 521 switch (param.takes_value) {
522 .none => {}, 522 .none => {},
523 .one => try cs.print(" <{}>", .{try valueText(context, param)}), 523 .one => try cs.print(" <{s}>", .{try valueText(context, param)}),
524 .many => try cs.print(" <{}>...", .{try valueText(context, param)}), 524 .many => try cs.print(" <{s}>...", .{try valueText(context, param)}),
525 } 525 }
526 526
527 try cs.writeByte(']'); 527 try cs.writeByte(']');
@@ -530,7 +530,7 @@ pub fn usageFull(
530 if (positional) |p| { 530 if (positional) |p| {
531 if (cos.bytes_written != 0) 531 if (cos.bytes_written != 0)
532 try cs.writeByte(' '); 532 try cs.writeByte(' ');
533 try cs.print("<{}>", .{try valueText(context, p)}); 533 try cs.print("<{s}>", .{try valueText(context, p)});
534 } 534 }
535} 535}
536 536