| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
## no critic (RequireUseStrict) |
|
2
|
|
|
|
|
|
|
package Bash::Completion::Plugins::App::Cmd; |
|
3
|
|
|
|
|
|
|
{ |
|
4
|
|
|
|
|
|
|
$Bash::Completion::Plugins::App::Cmd::VERSION = '0.01'; |
|
5
|
|
|
|
|
|
|
} |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
## use critic (RequireUseStrict) |
|
8
|
1
|
|
|
1
|
|
2418
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use parent 'Bash::Completion::Plugin'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
1912
|
use Bash::Completion::Utils qw(prefix_match); |
|
|
1
|
|
|
|
|
2711
|
|
|
|
1
|
|
|
|
|
76
|
|
|
13
|
1
|
|
|
1
|
|
1502
|
use Class::Load qw(load_class); |
|
|
1
|
|
|
|
|
47474
|
|
|
|
1
|
|
|
|
|
159
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub complete { |
|
16
|
4
|
|
|
4
|
1
|
3738
|
my ( $self, $r ) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
4
|
|
|
|
|
13
|
my $class = $self->command_class; |
|
19
|
4
|
|
|
|
|
19
|
load_class($class); |
|
20
|
|
|
|
|
|
|
|
|
21
|
4
|
|
|
|
|
43617
|
my @names = $class->command_names; |
|
22
|
|
|
|
|
|
|
|
|
23
|
4
|
|
|
|
|
12016
|
$r->candidates(prefix_match($r->word, @names)); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=pod |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Bash::Completion::Plugins::App::Cmd - A Bash::Completion plugin for writing App::Cmd plugins |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 VERSION |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
version 0.01 |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use parent 'Bash::Completion::Plugins::App::Cmd'; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# fill in everything you normally would for Bash::Completion, |
|
45
|
|
|
|
|
|
|
# except for complete |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub command_class { 'My::Cmd' } # mandatory |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This is a L plugin that assists in writing other |
|
52
|
|
|
|
|
|
|
L plugins for programs that use L. Everything |
|
53
|
|
|
|
|
|
|
is done similar to writing a normal L plugin, except you |
|
54
|
|
|
|
|
|
|
need to define the L method rather than the |
|
55
|
|
|
|
|
|
|
L<'Bash::Completion::Plugin'/complete> method. L is |
|
56
|
|
|
|
|
|
|
the name of the class that you use C |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 complete |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Populates the L request with commands from the |
|
63
|
|
|
|
|
|
|
given L class. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 command_class |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns the name of the class that this plugin will extract command |
|
68
|
|
|
|
|
|
|
names from. This method must be implemented by subclasses. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L, L |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Rob Hoelz |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Rob Hoelz. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
83
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 BUGS |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
|
88
|
|
|
|
|
|
|
https://github.com/hoelzro/bash-completion-plugins-app-cmd/issues |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
91
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
92
|
|
|
|
|
|
|
feature. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |