Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
implement trait "is hidden_from_USAGE"
MAIN candidates marked with this trait will not appear in the USAGE message
  • Loading branch information
moritz committed Dec 21, 2014
1 parent cc9f35a commit 4fa65d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/Main.pm
Expand Up @@ -85,6 +85,7 @@ my sub MAIN_HELPER($retval = 0) is hidden_from_backtrace {

my $prog-name = $*PROGRAM_NAME eq '-e' ?? "-e '...'" !! strip_path_prefix($*PROGRAM_NAME);
for $m.candidates -> $sub {
next if $sub.?is_hidden_from_USAGE;
my (@required-named, @optional-named, @positional, $docs);
for $sub.signature.params -> $param {
my $argument;
Expand Down
6 changes: 6 additions & 0 deletions src/core/traits.pm
Expand Up @@ -344,6 +344,12 @@ multi trait_mod:<is>(Routine:D $r, :$hidden_from_backtrace!) {
});
}

multi trait_mod:<is>(Routine:D $r, :$hidden_from_USAGE!) {
$r.HOW.mixin($r, role {
method is_hidden_from_USAGE { True }
});
}

multi trait_mod:<is>(Routine:D $r, :$pure!) {
$r.HOW.mixin($r, role {
method IS_PURE { True }
Expand Down

0 comments on commit 4fa65d4

Please sign in to comment.