line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::PAIA::Command::help; |
2
|
4
|
|
|
4
|
|
1426
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
90
|
|
3
|
4
|
|
|
4
|
|
26
|
use v5.10; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
110
|
|
4
|
4
|
|
|
4
|
|
12
|
use parent 'App::Cmd::Command::help'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
13
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub execute { |
9
|
0
|
|
|
0
|
1
|
|
my ($self, $opts, $args) = @_; |
10
|
|
|
|
|
|
|
|
11
|
0
|
0
|
|
|
|
|
if ($self->app->global_options->version) { |
12
|
0
|
|
|
|
|
|
$self->app->execute_command( $self->app->prepare_command('version') ); |
13
|
0
|
|
|
|
|
|
exit; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if (@$args) { |
17
|
0
|
|
|
|
|
|
my $command = $args->[0]; |
18
|
0
|
|
|
|
|
|
my ($cmd, $opt, $args) = $self->app->prepare_command(@$args); |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if (ref($cmd) =~ /::commands$/) { # unrecognized command |
21
|
0
|
|
|
|
|
|
say $self->app->usage->leader_text; |
22
|
0
|
|
|
|
|
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
require Getopt::Long::Descriptive; |
26
|
0
|
|
|
|
|
|
Getopt::Long::Descriptive->VERSION(0.084); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my (undef, $usage) = Getopt::Long::Descriptive::describe_options( |
29
|
|
|
|
|
|
|
$cmd->usage_desc, $cmd->opt_spec, App::PAIA->global_opt_spec |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $desc = $cmd->description; chomp $desc; |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
say join "\n\n", grep { defined $_ } |
34
|
0
|
0
|
|
|
|
|
eval { $usage->leader_text }, |
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
length $desc ? $desc : undef, |
36
|
|
|
|
|
|
|
"Global options:\n".$self->app->usage->option_text; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if ($cmd->usage->option_text) { |
39
|
0
|
|
|
|
|
|
say "Command options:"; |
40
|
0
|
|
|
|
|
|
say eval { $cmd->usage->option_text }; |
|
0
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} else { |
44
|
0
|
|
|
|
|
|
say $self->app->usage->leader_text; |
45
|
0
|
|
|
|
|
|
say; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my @cmd_groups = ( |
48
|
|
|
|
|
|
|
"PAIA auth commands" => [qw(login logout change)], |
49
|
|
|
|
|
|
|
"PAIA core commands" => [qw(patron items request renew cancel fees)], |
50
|
|
|
|
|
|
|
"client commands" => [qw(config session help)] |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
while (@cmd_groups) { |
54
|
0
|
|
|
|
|
|
say shift(@cmd_groups) . ":"; |
55
|
0
|
|
|
|
|
|
for my $command (@{ shift @cmd_groups }) { |
|
0
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $abstract = $self->app->plugin_for($command)->abstract; |
57
|
0
|
|
|
|
|
|
printf "%9s: %s\n", $command, $abstract; |
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
|
say; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
say "call 'paia help ' or 'perldoc paia' for more details."; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
__END__ |