line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CLI::Framework::Command::Help; |
2
|
3
|
|
|
3
|
|
3634
|
use base qw( CLI::Framework::Command::Meta ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
2303
|
|
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
108
|
|
5
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
20
|
|
|
3
|
|
|
|
|
627
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.01; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#------- |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub usage_text { |
12
|
0
|
|
|
0
|
1
|
0
|
q{ |
13
|
|
|
|
|
|
|
help [command name]: usage information for an individual command or the application itself |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub run { |
18
|
2
|
|
|
2
|
1
|
6
|
my ($self, $opts, @args) = @_; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
17
|
my $app = $self->get_app(); # metacommand is app-aware |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
5
|
my $usage; |
23
|
2
|
|
|
|
|
4
|
my $command_name = shift @args; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Recognize help requests that refer to the target command by an alias... |
26
|
2
|
|
|
|
|
12
|
my %alias = $app->command_alias(); |
27
|
2
|
50
|
33
|
|
|
26
|
$command_name = $alias{$command_name} if $command_name && exists $alias{$command_name}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# First, attempt to get command-specific usage message... |
30
|
2
|
50
|
|
|
|
9
|
if( $command_name ) { |
31
|
|
|
|
|
|
|
# (do not show command-specific usage message for non-interactive |
32
|
|
|
|
|
|
|
# commands when in interactive mode) |
33
|
0
|
0
|
0
|
|
|
0
|
$usage = $app->usage( $command_name, @args ) |
34
|
|
|
|
|
|
|
unless( $app->get_interactivity_mode() && ! $app->is_interactive_command($command_name) ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
# Fall back to application usage message... |
37
|
2
|
|
33
|
|
|
25
|
$usage ||= $app->usage(); |
38
|
2
|
|
|
|
|
8
|
return $usage; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#------- |
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |