Created
February 23, 2017 20:29
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env perl6 | |
use v6; | |
sub USAGE () { | |
print Q:c:to/EOH/; | |
Usage: {$*PROGRAM-NAME} [FILE|PATH] | |
Scan a single pod6 file or pod6 files under a path for method declarations, | |
infer the typename from the filename and output any methods name that is | |
found in the type but not in the pod6 file. | |
EOH | |
} | |
sub MAIN($source-path = './doc/Type/', Str :$exclude = ".git", :$ignore = 'util/ignored-methods.txt') { | |
my \exclude = none('.', '..', $exclude.split(',')); | |
my \type-pod-files := $source-path.ends-with('.pod6') | |
?? ($source-path.IO,) | |
!! gather for $source-path { | |
take .IO when .IO.f && .Str.ends-with('.pod6'); | |
.IO.dir(test => exclude)».&?BLOCK when .IO.d | |
} | |
my $prefix-length = $source-path.ends-with('.pod6') ?? ($source-path.chars - $source-path.IO.basename.chars) !! $source-path.chars; | |
# lazy list of (type-name, IO::PATH) | |
my \types := gather for type-pod-files».IO { | |
my $file-path = .substr($prefix-length); | |
my $type-name = $file-path.chop(5).subst(:g, '/', '::'); | |
try take (::($type-name), .IO) | |
} | |
say types[*;0].grep: * ~~ Cool; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment