lib/Shell/Amazon/S3/Plugin/Completion.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 34 SCAR 6.9
CC
1
Cov
0%
BEFORE_PLUGIN
2.0
_completion
2.0
complete
2.0
CRAP 2.0
1 package Shell::Amazon::S3::Plugin::Completion;
2 use strict;
3 use Shell::Amazon::S3::Plugin;
4 use Scalar::Util 'weaken';
5 use namespace::clean -except => ['meta'];
6  
7 sub BEFORE_PLUGIN {
8 my ($self) = @_;
9  
10 my $weakself = $self;
11 weaken($weakself);
12  
13 $self->term->Attribs->{completion_function} = sub {
14 $weakself->_completion(@_);
15 };
16 }
17  
18 sub _completion {
19 my ( $self, $text, $line, $start, $end ) = @_;
20  
21 my @command_list = qw(
22 bucket count createbucket delete deleteall deletebucket
23 exit get getfile getacl gettorrent head host help list listbuckets listatom
24 listrss pass put putfile putfilewacl quit setacl user
25 );
26  
27 my @matched = grep { $_ =~ /^$text/ } @command_list;
28 return @matched;
29 }
30  
31 sub complete {
32 return ();
33 }
34  
35 1;
36