commands
<>.sort -> $pod { next if $for && $pod !~~ / $for /; my ($cmd,$desc) = "$pod".split('--'); next unless $desc; my $line = $pod.WHEREFORE.?line; my $file = $pod.WHEREFORE.?file; $file = Nil if $file && $file ~~ /precomp/; if !$file && $?FILE.words[0].IO.e { state @lines = $?FILE.words[0].IO.lines; with @lines.first(:k, {.contains("$pod")}) { $file = $?FILE; $line = $_; } } @help.push: { text => sprintf(" \\%-30s %s",$cmd.trim,$desc.trim), file => $file, line => $line, cmd => $cmd.trim, desc => $desc.trim, } } for self.^methods -> $m { next unless $m.name ~~ /^ <[a..z]>/; next if $for && $m.name !~~ / $for /; unless $m.WHY { # note "No docs for {$m.name}"; next; } my $desc = $m.WHY.Str.trim; my $args = ''; if $desc ~~ /^ $<args>=[.*] '--' $<desc>=[.*] $/ { $args = " {$<args>.trim}"; $desc = $<desc>.trim; } @help.push: { text => sprintf(" \\%-30s %s",$m.name.trim ~ $args,$desc), file => $m.?file, line => $m.?line, cmd => $m.name.trim, desc => $desc.trim, } } @help; }