line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Plugin::BashCompletion; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
3837
|
use 5.010; |
|
4
|
|
|
|
|
18
|
|
6
|
4
|
|
|
4
|
|
24
|
use utf8; |
|
4
|
|
|
|
|
29
|
|
|
4
|
|
|
|
|
30
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
110
|
use namespace::autoclean; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
31
|
|
9
|
4
|
|
|
4
|
|
342
|
use Moose::Role; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
45
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub plugin_metaroles { |
12
|
3
|
|
|
3
|
0
|
10
|
my ($self,$class) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return { |
15
|
3
|
|
|
|
|
16
|
class => ['MooseX::App::Plugin::BashCompletion::Meta::Class'], |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
around 'initialize_command_class' => sub { |
20
|
|
|
|
|
|
|
my $orig = shift; |
21
|
|
|
|
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $return = $self->$orig(@_); |
24
|
|
|
|
|
|
|
if (blessed $return |
25
|
|
|
|
|
|
|
&& $return->isa('MooseX::App::Plugin::BashCompletion::Command')) { |
26
|
|
|
|
|
|
|
return $return->bash_completion($self); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $return; |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=encoding utf8 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
MooseX::App::Plugin::BashCompletion - Bash completion for your MooseX::App applications |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
In your base class: |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package MyApp; |
47
|
|
|
|
|
|
|
use MooseX::App qw(BashCompletion); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
In your shell |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
bash$ myapp bash_completion > myapp-complete.sh |
52
|
|
|
|
|
|
|
bash$ source myapp-complete.sh |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This plugin generates a bash completion definition for your application. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L<MooseX::App::Cmd::Command::BashComplete> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |