Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix MAIN's usage message in case of slurpy hash parameters
  • Loading branch information
cygx committed Oct 12, 2015
1 parent 06fef86 commit 61a7089
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/core/Main.pm
Expand Up @@ -69,14 +69,20 @@ my sub MAIN_HELPER($retval = 0) {
for $sub.signature.params -> $param {
my $argument;
if $param.named {
my @names = $param.named_names.reverse;
$argument = @names.map({($^n.chars == 1 ?? '-' !! '--') ~ $^n}).join('|');
$argument ~= "=<{$param.type.^name}>" unless $param.type === Bool;
if $param.optional {
if $param.slurpy {
$argument = '--<' ~ substr($param.name,1) ~ '>=...';
@optional-named.push("[$argument]");
}
else {
@required-named.push($argument);
my @names = $param.named_names.reverse;
$argument = @names.map({($^n.chars == 1 ?? '-' !! '--') ~ $^n}).join('|');
$argument ~= "=<{$param.type.^name}>" unless $param.type === Bool;
if $param.optional {
@optional-named.push("[$argument]");
}
else {
@required-named.push($argument);
}
}
}
else {
Expand Down

0 comments on commit 61a7089

Please sign in to comment.