Skip to content

Commit

Permalink
Change USAGE generation
Browse files Browse the repository at this point in the history
- print usage for any wrong args, not just when --help is given
- don't shell-execute stuff from ENV vars; there isn't that much
    usage text to require a pager so no need to leave around
    ways for people to run arbitrary commands.
- reword Text::To::Pod require to avoid temporary bustitude with
    require; new version is more concice too and can be left this
    way even after require is fixed.
  • Loading branch information
zoffixznet committed Mar 7, 2017
1 parent 6be395e commit 8b76ce8
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions t/harness6
Expand Up @@ -118,18 +118,8 @@ multi sub MAIN(
TAP::Harness::SourceHandler::Perl6.new(:incdirs['lib'], :path($perlpath));
}
}
multi sub MAIN(Bool :$help!) {
require Pod::To::Text;
my $text = ::('Pod::To::Text').render($=pod[0]);
with %*ENV<PERLDOC_PAGER> // %*ENV<PAGER> -> $pager {
my $proc = shell($pager, :in);
$proc.in.print($text);
$proc.in.close;
}
else {
say $text;
}
}

sub USAGE { say "\n" ~ (require ::('Pod::To::Text')).render($=pod[0]) ~ "\n" }

=begin pod
Expand Down

0 comments on commit 8b76ce8

Please sign in to comment.