Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #549 from cygx/slurpy-hash-usage
Fix MAIN's usage message in case of slurpy hash parameters
  • Loading branch information
lizmat committed Dec 4, 2015
2 parents 47d2daf + 61a7089 commit 15a6179
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 15a6179

Please sign in to comment.