CohortExplorer/Command/Help.pm

filter: Statementstmt 40.7% 11 / 27 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 22.8% 16 / 70 CC 12 SCAR 47.6
CC
12
Cov
21%
run
156.0
usage_text
2.0
BEGIN
1.0
CRAP 117.3
« CohortExplorer/Datasource.pm ↑ Summary CohortExplorer/Application/Opal/Datasource.pm »
1 package CohortExplorer::Command::Help;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = 0.14;
7  
8 1 ▶use base qw( CLI::Framework::Command::Meta );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 #-------
12 0 ▶sub usage_text {
Subroutine usage_text: not called CC=1 SCAR=6.9
Pod documented
13 0 q{
14 help [command]: application or command specific usage
15 };
16 }
17  
18 0 ▶sub run {
Subroutine run: not called CC=12 SCAR=50.5
Pod documented
19 0 my ( $self, $opts, @args ) = @_;
20  
21 # Metacommand is app-aware
22 0 my $app = $self->get_app;
23 0 my $usage;
24 0 my $command_name = shift @args;
25  
26 # Recognise help requests that refer to the target command by an alias
27 0 my %alias = $app->command_alias;
28 0 ▶ $command_name = $alias{$command_name} if $command_name && exists $alias{$command_name};
Branch: 1 branch
BranchTrueFalseTotal
if $command_name and exists $alias{$command_name} 0 0 0
Condition0%0/3
$command_name and exists $alias{$command_name}
!ll&&!rl&&r
000
MC/DC0%0/2
$command_name and exists $alias{$command_name}
$command_name exists $alias{$command_name}
Truth table0%0/3
A and B
A= $command_nameB= exists $alias{$command_name}
ABresult
0X0
100
111
29 0 my $h = $app->command_map_hashref;
30  
31 # First, attempt to get command-specific usage
32 0 ▶ if ($command_name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($command_name) 0 0 0
33  
34 # (do not show command-specific usage message for non-interactive
35 # commands when in interactive mode)
36 0 ▶ $usage = $app->usage( $command_name, @args )
Branch: 1 branch
BranchTrueFalseTotal
unless $app->get_interactivity_mode and not $app->is_interactive_command($command_name) 0 0 0
Condition0%0/3
$app->get_interactivity_mode and not $app->is_interactive_command($command_name)
!ll&&!rl&&r
000
MC/DC0%0/2
$app->get_interactivity_mode and not $app->is_interactive_command($command_name)
$app->get_interactivity_mode not $app->is_interactive_command($command_name)
Truth table0%0/3
A and not(B)
A= $app->get_interactivity_modeB= not $app->is_interactive_command($command_name)
ABresult
0X0
100
111
37 unless ( $app->get_interactivity_mode
38 && !$app->is_interactive_command($command_name) );
39 }
40 0 my $app_usage = $app->usage;
41  
42 # Remove usage of invalid/noninteractive commands from application help
43 0 for ( $app->noninteractive_commands ) {
44 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^(?:search|compare|history)$/ and not $app->is_interactive_command($_) or $_ =~ /^(?:menu|console)$/ and $app->get_interactivity_mode) 0 0 0
Condition0%0/9
$_ =~ /^(?:search|compare|history)$/ and not $app->is_interactive_command($_) or $_ =~ /^(?:menu|console)$/ and $app->get_interactivity_mode
l!l&&r!l&&!r
000
$_ =~ /^(?:search|compare|history)$/ and not $app->is_interactive_command($_)
!ll&&!rl&&r
000
$_ =~ /^(?:menu|console)$/ and $app->get_interactivity_mode
!ll&&!rl&&r
000
MC/DC0%0/4
$_ =~ /^(?:search|compare|history)$/ and not $app->is_interactive_command($_) or $_ =~ /^(?:menu|console)$/ and $app->get_interactivity_mode
$_ =~ /^(?:search|compare|history)$/ not $app->is_interactive_command($_) $_ =~ /^(?:menu|console)$/ $app->get_interactivity_mode
Truth table0%0/7
A and not(B) or C and D
A= $_ =~ /^(?:search|compare|history)$/B= not $app->is_interactive_command($_)C= $_ =~ /^(?:menu|console)$/D= $app->get_interactivity_mode
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
45 (
46 $_ =~ /^(?:search|compare|history)$/ && !$app->is_interactive_command($_)
47 )
48 || ( $_ =~ /^(?:menu|console)$/ && $app->get_interactivity_mode )
49 )
50 {
51 0 $app_usage =~ s/\n\s+$_\s+\-[^\n]+//;
52 }
53 }
54  
55 # Fall back to application usage message
56 0 ▶ $usage ||= $app_usage;
Condition0%0/3
$usage ||= $app_usage
l!l&&r!l&&!r
000
MC/DC0%0/2
$usage ||= $app_usage
$usage $app_usage
Truth table0%0/3
A ||= B
A= $usageB= $app_usage
ABresult
1X1
011
000
57 0 return $usage;
58 }
59  
60 #-------
61 1 1;
62 __END__
« CohortExplorer/Datasource.pm ↑ Summary CohortExplorer/Application/Opal/Datasource.pm »