| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bash::Completion::Plugins::BashComplete; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$Bash::Completion::Plugins::BashComplete::VERSION = '0.008'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Plugin for bash-complete |
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1777
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
76
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
70
|
|
|
10
|
2
|
|
|
2
|
|
1150
|
use parent 'Bash::Completion::Plugin'; |
|
|
2
|
|
|
|
|
408
|
|
|
|
2
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
|
|
use Bash::Completion::Utils |
|
12
|
2
|
|
|
2
|
|
1075
|
qw( command_in_path match_perl_modules prefix_match ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
529
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub should_activate { |
|
16
|
1
|
|
|
1
|
1
|
4
|
my @commands = ('bash-complete'); |
|
17
|
1
|
|
|
|
|
3
|
return [grep { command_in_path($_) } @commands]; |
|
|
1
|
|
|
|
|
6
|
|
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my @commands = qw{ setup complete }; |
|
23
|
|
|
|
|
|
|
my @options = ('--help', '-h'); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub complete { |
|
26
|
3
|
|
|
3
|
1
|
6
|
my ($class, $req) = @_; |
|
27
|
3
|
|
|
|
|
10
|
my $word = $req->word; |
|
28
|
3
|
|
|
|
|
10
|
my @args = $req->args; |
|
29
|
3
|
|
|
|
|
9
|
my $count = $req->count; |
|
30
|
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
4
|
my @c; |
|
32
|
3
|
50
|
100
|
|
|
32
|
if (index($word, '-') == 0) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
@c = prefix_match($word, @options); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
elsif ($count >= 2 && $args[1] eq 'complete') { |
|
36
|
1
|
|
|
|
|
6
|
@c = match_perl_modules("Bash::Completion::Plugins::$word"); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
elsif ($count <= 2) { |
|
39
|
2
|
|
|
|
|
9
|
@c = prefix_match($word, @commands, @options); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
14
|
$req->candidates(@c); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=pod |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 NAME |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Bash::Completion::Plugins::BashComplete - Plugin for bash-complete |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 VERSION |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
version 0.008 |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
## not to be used directly |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
A plugin for the C command. Completes options and |
|
66
|
|
|
|
|
|
|
sub-commands. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
For the C sub-command, it completes with the plugin names. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 METHODS |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 should_activate |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Makes sure we only activate this plugin if we can find C |
|
75
|
|
|
|
|
|
|
in our PATH. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 complete |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Completion logic for C |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHOR |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Pedro Melo |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This software is Copyright (c) 2011 by Pedro Melo. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is free software, licensed under: |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |