Skip to content

Commit

Permalink
Print multi value positionals correctly in usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Hejsil committed Apr 28, 2022
1 parent ac5f465 commit 996821a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clap.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,8 @@ pub fn usage(stream: anytype, comptime Id: type, params: []const Param(Id)) !voi
try cs.writeAll("<");
try cs.writeAll(p.id.value());
try cs.writeAll(">");
if (p.takes_value == .many)
try cs.writeAll("...");
}
}

Expand Down Expand Up @@ -1769,6 +1771,10 @@ test "usage" {
\\<file>
\\
));
try testUsage("<file>...", &comptime parseParamsComptime(
\\<file>...
\\
));
try testUsage(
"[-ab] [-c <value>] [-d <v>] [--e] [--f] [--g <value>] [--h <v>] [-i <v>...] <file>",
&comptime parseParamsComptime(
Expand Down

0 comments on commit 996821a

Please sign in to comment.