Skip to content

Commit

Permalink
experimental -f support for methods if index.data exists
Browse files Browse the repository at this point in the history
  • Loading branch information
stmuk committed Aug 2, 2014
1 parent c24c97d commit 8093e18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 12 additions & 2 deletions bin/p6doc
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,18 @@ multi sub MAIN($docee) {
multi sub MAIN($docee, Bool :$f!) {
my ($package, $method) = $docee.split('.');
unless $method {
say 'unqualified sub and method names are not yet implemented';
say 'For example use "p6doc -f Str.split" instead of "p6doc -f split" for now';
if 'index.data'.IO ~~ :e {
my %data = EVAL slurp 'index.data';
my $ndocee = "method "~$docee;
if %data{$ndocee} {
my $newdoc = %data{$ndocee}[0][0] ~ "." ~ $docee;
return MAIN($newdoc, :f);
}
show-docs(locate-module($docee));
}
say 'Unqualified sub and method names like "p6doc -f say" are experimental';
say 'in order to use them you will need to run index.p6 to build index.data';
say 'otherwise use "p6doc -f Str.split" instead of "p6doc -f split" for now';
exit 2;
}
my $m = locate-module($package);
Expand Down
1 change: 0 additions & 1 deletion index.p6
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ multi sub MAIN('index') {
#if $row ~~ /^\=(item|head\d) \s+ X\<(.*)\> \s*$/ {
if $row ~~ /^\=(item|head\d) \s+ (.*?) \s*$/ {
$section = $1.Str;
$section.=subst(/\|/,"",:g);
%words{$section}.push([$pod, $section]);
}
if $row ~~ /X\<(.*?)\>/ and $section {
Expand Down

0 comments on commit 8093e18

Please sign in to comment.