@@ -52,8 +52,10 @@ sub locate-module(Str $modulename) {
52
52
return $ m ;
53
53
}
54
54
55
- sub show-docs (Str $ path , : $ section ) {
56
- my $ pager = % * ENV <PAGER > // ($ * DISTRO . name eq ' mswin32' ?? ' more' !! ' less' );
55
+ 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
+ }
57
59
my $ which-fmt = qq :x { which fmt } . chomp ;
58
60
my $ fmt-string = $ which-fmt . IO . e ?? " | $ which-fmt -w 80 " !! " " ;
59
61
if not open ($ path ). lines . grep ( /^ '=' | '#|' | '#=' / ) {
@@ -80,9 +82,12 @@ multi sub MAIN() {
80
82
81
83
say " \n You can also look up specific method/routine definitions:" ;
82
84
say " $ me -f push" ;
85
+
86
+ say " \n You can bypass the pager and print straight to stdout:" ;
87
+ say " $ me -n Type::Str"
83
88
}
84
89
85
- multi sub MAIN ($ docee ) {
90
+ multi sub MAIN ($ docee , Bool : $ n ) {
86
91
return MAIN($ docee , : f) if defined $ docee . index (' .' ) ;
87
92
if INDEX. IO ~~ : e {
88
93
my % data = EVALFILE INDEX;
@@ -91,7 +96,11 @@ multi sub MAIN($docee) {
91
96
return MAIN($ newdoc );
92
97
}
93
98
}
94
- show-docs(locate-module($ docee ));
99
+ if $ n {
100
+ show-docs(locate-module($ docee ), : no-pager)
101
+ } else {
102
+ show-docs(locate-module($ docee ));
103
+ }
95
104
}
96
105
97
106
multi sub MAIN ($ docee , Bool : $ f ! ) {
0 commit comments