Skip to content

Commit 004c7b7

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 30c4baf + c8961ab commit 004c7b7

File tree

6 files changed

+1092
-15
lines changed

6 files changed

+1092
-15
lines changed

bin/p6doc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,26 @@ sub locate-module(Str $modulename) {
5353
}
5454

5555
sub show-docs(Str $path, :$section, :$no-pager) {
56-
my $pager = do if $no-pager.defined { 'cat' } else {
57-
%*ENV<PAGER> // ($*DISTRO.name eq 'mswin32' ?? 'more' !! 'less');
58-
}
56+
my $pager;
57+
$pager = %*ENV<PAGER> // ($*DISTRO.is-win ?? 'more' !! 'less') unless $no-pager;
5958
my $which-fmt = qq:x{which fmt}.chomp;
6059
my $fmt-string = $which-fmt.IO.e ?? "| $which-fmt -w 80 " !! "";
6160
if not open($path).lines.grep( /^'=' | '#|' | '#='/ ) {
6261
say "No Pod found in $path";
6362
return;
6463
}
64+
my $doc-command-str = "$*EXECUTABLE-NAME";
6565
if $section.defined {
6666
%*ENV<PERL6_POD_HEADING> = $section;
6767
my $i = findbin() ~ '../lib';
68-
say "launching '$*EXECUTABLE-NAME -I$i --doc=SectionFilter $path $fmt-string | $pager'" if DEBUG;
69-
shell "$*EXECUTABLE-NAME -I$i --doc=SectionFilter $path $fmt-string | $pager";
70-
}
71-
else {
72-
say "launching '$*EXECUTABLE-NAME --doc $path $fmt-string | $pager'" if DEBUG;
73-
shell "$*EXECUTABLE-NAME --doc $path $fmt-string | $pager";
68+
$doc-command-str ~= " -I$i --doc=SectionFilter"
69+
} else {
70+
$doc-command-str ~= " --doc"
7471
}
72+
$doc-command-str ~= " $path $fmt-string";
73+
$doc-command-str ~= " | $pager" if $pager;
74+
say "launching '$doc-command-str'" if DEBUG;
75+
shell $doc-command-str;
7576
}
7677

7778
multi sub MAIN() {

0 commit comments

Comments
 (0)