summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Inkster <mail@tobyinkster.co.uk>2013-06-28 10:41:18 +0100
committerJesse Luehrs <doy@tozt.net>2013-06-28 10:48:40 -0400
commit3c80d9cb9c7c095b7d176a3dd225083f0e9706fb (patch)
tree6cb6db47760207601dcb2ee41e30cbab02b4471a
parentd7f02f77969c003f2018855fe7fc7619c3361347 (diff)
downloadreply-3c80d9cb9c7c095b7d176a3dd225083f0e9706fb.tar.gz
reply-3c80d9cb9c7c095b7d176a3dd225083f0e9706fb.zip
listen to events published by Packages plugin to find out the names of more packages for autocompletion
-rw-r--r--lib/Reply/Plugin/Autocomplete/Packages.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Packages.pm b/lib/Reply/Plugin/Autocomplete/Packages.pm
index d247baa..6e6037d 100644
--- a/lib/Reply/Plugin/Autocomplete/Packages.pm
+++ b/lib/Reply/Plugin/Autocomplete/Packages.pm
@@ -43,7 +43,19 @@ sub tab_handler {
}
}
+ push @results,
+ grep m/^\Q$package_fragment/,
+ @{$self->{moar_packages}||=[]};
+
return @results;
}
+# listen for events from the Packages plugin, for its wise wisdom
+# can teach us about packages that are not in %INC
+sub package {
+ my $self = shift;
+ my ($pkg) = @_;
+ push @{$self->{moar_packages}||=[]}, $pkg;
+}
+
1;