line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: zsh completion for your MooseX::App applications |
2
|
2
|
|
|
2
|
|
906948
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
61
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
58
|
|
4
|
|
|
|
|
|
|
package MooseX::App::Plugin::ZshCompletion; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
28
|
use 5.010; |
|
2
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.002_001'; # TRIAL VERSION |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
389
|
use namespace::autoclean; |
|
2
|
|
|
|
|
14501
|
|
|
2
|
|
|
|
|
8
|
|
11
|
2
|
|
|
2
|
|
483
|
use Moose::Role; |
|
2
|
|
|
|
|
396714
|
|
|
2
|
|
|
|
|
11
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub plugin_metaroles { |
14
|
1
|
|
|
1
|
1
|
4179
|
my ($self,$class) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
return { |
17
|
1
|
|
|
|
|
3
|
class => ['MooseX::App::Plugin::ZshCompletion::Meta::Class'], |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
around 'initialize_command_class' => sub { |
22
|
|
|
|
|
|
|
my $orig = shift; |
23
|
|
|
|
|
|
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $return = $self->$orig(@_); |
26
|
|
|
|
|
|
|
if (blessed $return |
27
|
|
|
|
|
|
|
&& $return->isa('MooseX::App::Plugin::ZshCompletion::Command')) { |
28
|
|
|
|
|
|
|
return $return->zsh_completion($self); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
return $return; |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding utf8 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
MooseX::App::Plugin::ZshCompletion - zsh completion for your MooseX::App applications |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
In your base class: |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
package MyApp; |
49
|
|
|
|
|
|
|
use MooseX::App qw/ ZshCompletion /; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
In your .zshrc: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
fpath=('/path/to/completion-dir' $fpath) |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
In your shell |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
zsh% myapp zsh_completion > /path/to/completion-dir/_myapp |
58
|
|
|
|
|
|
|
zsh% chmod u+x /path/to/completion-dir/_myapp |
59
|
|
|
|
|
|
|
zsh% exec zsh |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This plugin generates a zsh completion definition for your application. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Completion works for subcommands, parameters and options. If an option or |
66
|
|
|
|
|
|
|
parameter is declared as an C<enum> with L<Moose::Meta::TypeConstraint> you |
67
|
|
|
|
|
|
|
will get a completion for the enum values. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Option completions will show its descriptions also. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The default completion type for parameters is C<_files> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
In the examples directory you find C<moosex-app-zsh>. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
% moosex-app-zsh <TAB> |
76
|
|
|
|
|
|
|
bash_completion fetch_mail help lala zsh_completion |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
% moosex-app-zsh fetch_mail server.example -<TAB> |
79
|
|
|
|
|
|
|
--dir -- Output 'dir' |
80
|
|
|
|
|
|
|
--max -- Maximum number of emails to fetch |
81
|
|
|
|
|
|
|
--servertype -- Mailserver type: IMAP or POP3 |
82
|
|
|
|
|
|
|
--usage --help -h -- Prints this usage information. |
83
|
|
|
|
|
|
|
--user -- User |
84
|
|
|
|
|
|
|
--verbose -- be verbose |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
% moosex-app-zsh fetch_mail server.example --servertype <TAB> |
87
|
|
|
|
|
|
|
IMAP POP3 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 METHODS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=over 4 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item plugin_metaroles |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SEE ALSO |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
L<MooseX::App::Plugin::BashCompletion> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 LICENSE |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Copyright (C) 2015 by Tina Mueller |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
108
|
|
|
|
|
|
|
the same terms as Perl itself. The full text of the license can be found |
109
|
|
|
|
|
|
|
in the LICENSE file. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|