diff options
Diffstat (limited to 'clap.zig')
| -rw-r--r-- | clap.zig | 22 |
1 files changed, 11 insertions, 11 deletions
| @@ -259,7 +259,7 @@ pub const Diagnostic = struct { | |||
| 259 | 259 | ||
| 260 | /// Default diagnostics reporter when all you want is English with no colors. | 260 | /// Default diagnostics reporter when all you want is English with no colors. |
| 261 | /// Use this as a reference for implementing your own if needed. | 261 | /// Use this as a reference for implementing your own if needed. |
| 262 | pub fn report(diag: Diagnostic, stream: var, err: anyerror) !void { | 262 | pub fn report(diag: Diagnostic, stream: anytype, err: anyerror) !void { |
| 263 | const Arg = struct { | 263 | const Arg = struct { |
| 264 | prefix: []const u8, | 264 | prefix: []const u8, |
| 265 | name: []const u8, | 265 | name: []const u8, |
| @@ -354,11 +354,11 @@ pub fn parse( | |||
| 354 | /// --long helpText | 354 | /// --long helpText |
| 355 | /// --long <valueText> helpText | 355 | /// --long <valueText> helpText |
| 356 | pub fn helpFull( | 356 | pub fn helpFull( |
| 357 | stream: var, | 357 | stream: anytype, |
| 358 | comptime Id: type, | 358 | comptime Id: type, |
| 359 | params: []const Param(Id), | 359 | params: []const Param(Id), |
| 360 | comptime Error: type, | 360 | comptime Error: type, |
| 361 | context: var, | 361 | context: anytype, |
| 362 | helpText: fn (@TypeOf(context), Param(Id)) Error![]const u8, | 362 | helpText: fn (@TypeOf(context), Param(Id)) Error![]const u8, |
| 363 | valueText: fn (@TypeOf(context), Param(Id)) Error![]const u8, | 363 | valueText: fn (@TypeOf(context), Param(Id)) Error![]const u8, |
| 364 | ) !void { | 364 | ) !void { |
| @@ -387,11 +387,11 @@ pub fn helpFull( | |||
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | fn printParam( | 389 | fn printParam( |
| 390 | stream: var, | 390 | stream: anytype, |
| 391 | comptime Id: type, | 391 | comptime Id: type, |
| 392 | param: Param(Id), | 392 | param: Param(Id), |
| 393 | comptime Error: type, | 393 | comptime Error: type, |
| 394 | context: var, | 394 | context: anytype, |
| 395 | valueText: fn (@TypeOf(context), Param(Id)) Error![]const u8, | 395 | valueText: fn (@TypeOf(context), Param(Id)) Error![]const u8, |
| 396 | ) !void { | 396 | ) !void { |
| 397 | if (param.names.short) |s| { | 397 | if (param.names.short) |s| { |
| @@ -419,7 +419,7 @@ fn printParam( | |||
| 419 | /// A wrapper around helpFull for simple helpText and valueText functions that | 419 | /// A wrapper around helpFull for simple helpText and valueText functions that |
| 420 | /// cant return an error or take a context. | 420 | /// cant return an error or take a context. |
| 421 | pub fn helpEx( | 421 | pub fn helpEx( |
| 422 | stream: var, | 422 | stream: anytype, |
| 423 | comptime Id: type, | 423 | comptime Id: type, |
| 424 | params: []const Param(Id), | 424 | params: []const Param(Id), |
| 425 | helpText: fn (Param(Id)) []const u8, | 425 | helpText: fn (Param(Id)) []const u8, |
| @@ -458,7 +458,7 @@ pub const Help = struct { | |||
| 458 | }; | 458 | }; |
| 459 | 459 | ||
| 460 | /// A wrapper around helpEx that takes a Param(Help). | 460 | /// A wrapper around helpEx that takes a Param(Help). |
| 461 | pub fn help(stream: var, params: []const Param(Help)) !void { | 461 | pub fn help(stream: anytype, params: []const Param(Help)) !void { |
| 462 | try helpEx(stream, Help, params, getHelpSimple, getValueSimple); | 462 | try helpEx(stream, Help, params, getHelpSimple, getValueSimple); |
| 463 | } | 463 | } |
| 464 | 464 | ||
| @@ -512,11 +512,11 @@ test "clap.help" { | |||
| 512 | /// First all none value taking parameters, which have a short name are | 512 | /// First all none value taking parameters, which have a short name are |
| 513 | /// printed, then non positional parameters and finally the positinal. | 513 | /// printed, then non positional parameters and finally the positinal. |
| 514 | pub fn usageFull( | 514 | pub fn usageFull( |
| 515 | stream: var, | 515 | stream: anytype, |
| 516 | comptime Id: type, | 516 | comptime Id: type, |
| 517 | params: []const Param(Id), | 517 | params: []const Param(Id), |
| 518 | comptime Error: type, | 518 | comptime Error: type, |
| 519 | context: var, | 519 | context: anytype, |
| 520 | valueText: fn (@TypeOf(context), Param(Id)) Error![]const u8, | 520 | valueText: fn (@TypeOf(context), Param(Id)) Error![]const u8, |
| 521 | ) !void { | 521 | ) !void { |
| 522 | var cos = io.countingOutStream(stream); | 522 | var cos = io.countingOutStream(stream); |
| @@ -569,7 +569,7 @@ pub fn usageFull( | |||
| 569 | /// A wrapper around usageFull for a simple valueText functions that | 569 | /// A wrapper around usageFull for a simple valueText functions that |
| 570 | /// cant return an error or take a context. | 570 | /// cant return an error or take a context. |
| 571 | pub fn usageEx( | 571 | pub fn usageEx( |
| 572 | stream: var, | 572 | stream: anytype, |
| 573 | comptime Id: type, | 573 | comptime Id: type, |
| 574 | params: []const Param(Id), | 574 | params: []const Param(Id), |
| 575 | valueText: fn (Param(Id)) []const u8, | 575 | valueText: fn (Param(Id)) []const u8, |
| @@ -593,7 +593,7 @@ pub fn usageEx( | |||
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | /// A wrapper around usageEx that takes a Param(Help). | 595 | /// A wrapper around usageEx that takes a Param(Help). |
| 596 | pub fn usage(stream: var, params: []const Param(Help)) !void { | 596 | pub fn usage(stream: anytype, params: []const Param(Help)) !void { |
| 597 | try usageEx(stream, Help, params, getValueSimple); | 597 | try usageEx(stream, Help, params, getValueSimple); |
| 598 | } | 598 | } |
| 599 | 599 | ||