summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/Autocomplete/Commands.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reply/Plugin/Autocomplete/Commands.pm')
-rw-r--r--lib/Reply/Plugin/Autocomplete/Commands.pm19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Commands.pm b/lib/Reply/Plugin/Autocomplete/Commands.pm
index e3b653d..5bc0661 100644
--- a/lib/Reply/Plugin/Autocomplete/Commands.pm
+++ b/lib/Reply/Plugin/Autocomplete/Commands.pm
@@ -1,9 +1,9 @@
-package Reply::Plugin::Autocomplete::Commands;
+package main;
use strict;
use warnings;
# ABSTRACT: tab completion for reply commands
-use base 'Reply::Plugin';
+use mop;
=head1 SYNOPSIS
@@ -17,16 +17,15 @@ This plugin registers a tab key handler to autocomplete Reply commands.
=cut
-sub tab_handler {
- my $self = shift;
- my ($line) = @_;
+class Reply::Plugin::Autocomplete::Commands extends Reply::Plugin {
+ method tab_handler ($line) {
+ my ($prefix) = $line =~ /^#(.*)/;
+ return unless defined $prefix;
- my ($prefix) = $line =~ /^#(.*)/;
- return unless defined $prefix;
+ my @commands = $self->publish('commands');
- my @commands = $self->publish('commands');
-
- return map { "#$_" } sort grep { index($_, $prefix) == 0 } @commands;
+ return map { "#$_" } sort grep { index($_, $prefix) == 0 } @commands;
+ }
}
1;