line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bash::Completion::Request; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Bash::Completion::Request::VERSION = '0.008'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Abstract a completion request |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
853
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
146
|
|
9
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1583
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
1
|
422
|
sub line { return $_[0]{line} } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
4
|
1
|
23
|
sub word { return $_[0]{word} } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
1
|
562
|
sub args { return @{$_[0]{args}} } |
|
4
|
|
|
|
|
24
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
4
|
1
|
12
|
sub count { return $_[0]{count} } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
1
|
6
|
sub point { return $_[0]{point} } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
4
|
|
|
4
|
1
|
953
|
my ($class) = @_; |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
18
|
return bless { |
36
|
|
|
|
|
|
|
candidates => [], |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
line => $ENV{COMP_LINE}, |
39
|
|
|
|
|
|
|
point => $ENV{COMP_POINT}, |
40
|
|
|
|
|
|
|
_get_completion_word(), |
41
|
|
|
|
|
|
|
_get_arguments(), |
42
|
|
|
|
|
|
|
}, $class; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub candidates { |
48
|
8
|
|
|
8
|
1
|
30
|
my $self = shift; |
49
|
8
|
|
|
|
|
15
|
my $c = $self->{candidates}; |
50
|
|
|
|
|
|
|
|
51
|
8
|
100
|
|
|
|
62
|
return @$c unless @_; |
52
|
|
|
|
|
|
|
|
53
|
4
|
|
|
|
|
19
|
push @$c, @_; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
####### |
58
|
|
|
|
|
|
|
# Utils |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
## Stolen from http://github.com/yanick/dist-zilla/blob/master/contrib/dzil-complete |
61
|
|
|
|
|
|
|
sub _get_completion_word { |
62
|
4
|
|
|
4
|
|
15
|
my $comp = substr $ENV{'COMP_LINE'}, 0, $ENV{'COMP_POINT'}; |
63
|
4
|
|
|
|
|
19
|
$comp =~ s/.*\s//; |
64
|
4
|
|
|
|
|
14
|
return word => $comp; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _get_arguments { |
68
|
4
|
|
|
4
|
|
13
|
my $comp = substr $ENV{'COMP_LINE'}, 0, $ENV{'COMP_POINT'}; |
69
|
4
|
|
|
|
|
15
|
my @args = split(/\s+/, $comp); |
70
|
|
|
|
|
|
|
|
71
|
4
|
|
|
|
|
39
|
return args => \@args, count => scalar(@args); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |