Skip to content

Commit 7eaf0aa

Browse files
committed
Handling optional type name arg in missing-methods
1 parent 1e3b216 commit 7eaf0aa

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

util/missing-methods.p6

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use Perl6::TypeGraph;
1212
1313
=head1 SYNOPSIS
1414
15-
$ perl6 util/missing-methods.p6
15+
$ perl6 util/missing-methods.p6 [--type_name=<Str>]
1616
1717
=head1 DESCRIPTION
1818
@@ -26,11 +26,15 @@ from outside.
2626
2727
=end pod
2828

29-
my $type_graph = Perl6::TypeGraph.new-from-file('type-graph.txt');
29+
sub MAIN(Str :$type_name) {
30+
my $type_graph = Perl6::TypeGraph.new-from-file('type-graph.txt');
31+
my @types_to_search = $type_name ?? $type_graph.types{$type_name}
32+
!! $type_graph.sorted;
3033

31-
for $type_graph.sorted -> $type {
32-
for methods-in-type($type) -> $method {
33-
show-undoc-method($type.name ~ '.' ~ $method.name);
34+
for @types_to_search -> $type {
35+
for methods-in-type($type) -> $method {
36+
show-undoc-method($type.name ~ '.' ~ $method.name);
37+
}
3438
}
3539
}
3640

0 commit comments

Comments
 (0)