diff options
author | Toby Inkster <mail@tobyinkster.co.uk> | 2013-06-28 10:41:18 +0100 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-06-28 10:48:40 -0400 |
commit | 3c80d9cb9c7c095b7d176a3dd225083f0e9706fb (patch) | |
tree | 6cb6db47760207601dcb2ee41e30cbab02b4471a /lib | |
parent | d7f02f77969c003f2018855fe7fc7619c3361347 (diff) | |
download | reply-3c80d9cb9c7c095b7d176a3dd225083f0e9706fb.tar.gz reply-3c80d9cb9c7c095b7d176a3dd225083f0e9706fb.zip |
listen to events published by Packages plugin to find out the names of more packages for autocompletion
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Reply/Plugin/Autocomplete/Packages.pm | 12 |
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; |