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