Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make default USAGE print .WHY for the documented candidates
  • Loading branch information
Tadeusz Sośnierz committed Feb 8, 2012
1 parent ef61a32 commit 2251cbb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/Main.pm
Expand Up @@ -110,7 +110,7 @@ my sub MAIN_HELPER($retval = 0) {
my @help-msgs;
my $prog-name = $*PROGRAM_NAME eq '-e' ?? "-e '...'" !! $*PROGRAM_NAME;
for $m.candidates -> $sub {
my (@required-named, @optional-named, @positional);
my (@required-named, @optional-named, @positional, $docs);
for $sub.signature.params -> $param {
my $argument;
if $param.named {
Expand All @@ -136,7 +136,10 @@ my sub MAIN_HELPER($retval = 0) {
@positional.push($argument);
}
}
my $msg = join(' ', $prog-name, @required-named, @optional-named, @positional);
if $sub.WHY {
$docs = '-- ' ~ $sub.WHY.content
}
my $msg = join(' ', $prog-name, @required-named, @optional-named, @positional, $docs // '');
@help-msgs.push($msg);
}
my $usage = "Usage:\n" ~ @help-msgs.map(' ' ~ *).join("\n");
Expand Down

0 comments on commit 2251cbb

Please sign in to comment.