| 1 | package DBIx::dbMan::Extension::LineComplete; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use base 'DBIx::dbMan::Extension'; | ||
| 5 | |||
| 6 | our $VERSION = '0.03'; | ||
| 7 | |||
| 8 | 1; | ||
| 9 | |||
| 10 | sub IDENTIFICATION { return "000001-000048-000003"; } | ||
| 11 | |||
| 12 | sub preference { return 3999; } | ||
| 13 | |||
| 14 | sub known_actions { return [ qw/LINE_COMPLETE/ ]; } | ||
| 15 | |||
| 16 | sub handle_action { | ||
| 17 | my ($obj,%action) = @_; | ||
| 18 | |||
| 19 | if ($action{action} eq 'LINE_COMPLETE') { | ||
| 20 | $action{list} = []; | ||
| 21 | my %maybe = (); | ||
| 22 | for my $ext (@{$obj->{-core}->{extensions}}) { | ||
| 23 | if ($ext->can('cmdcomplete')) { | ||
| 24 | study "\Q$action{text}"; | ||
| 25 | for ($ext->cmdcomplete($action{text},$action{line},$action{start})) { | ||
| 26 | ++$maybe{$_} if /^\Q$action{text}/i; | ||
| 27 | } | ||
| 28 | } | ||
| 29 | } | ||
| 30 | $action{list} = [ sort keys %maybe ]; | ||
| 31 | $action{action} = 'NONE'; | ||
| 32 | } | ||
| 33 | $action{processed} = 1; | ||
| 34 | |||
| 35 | return %action; | ||
| 36 | } |