blib/lib/App/RecordStream/Operation/help.pm

filter: Statementstmt 39.3% 13 / 33 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 6 totaltotal 30.3% 17 / 56 CC 4 SCAR 15.3
CC
4
Cov
34%
init_help
12.0
init
6.0
usage
2.0
CRAP 4.6
« blib/lib/App/RecordStream/Operation/toprettyprint.pm ↑ Summary blib/lib/App/RecordStream/InputStream.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package App::RecordStream::Operation::help;
5 1 ▶use base qw(App::RecordStream::Operation);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Carp qw< croak >;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub usage {
Subroutine usage: not called CC=1 SCAR=6.9
Pod undocumented
10 0 my $this = shift;
11 0 my $args_string = $this->options_string([]);
12  
13 0 return <<USAGE;
14 Usage: recs help <command-name>
15 recs help <option>
16 __FORMAT_TEXT__
17 Show help for the given command or options. Equivalent to using `recs
18 command --help` and friends.
19 __FORMAT_TEXT__
20  
21 Arguments:
22 $args_string
23  
24 Examples:
25 Show help for fromcsv command
26 recs help fromcsv
27 Show help for code snippets
28 recs help --snippet
29 USAGE
30 }
31  
32 0 ▶sub init_help {
Subroutine init_help: not called CC=3 SCAR=24.8
Pod undocumented
33 0 my $this = shift;
34 0 $this->SUPER::init_help(@_);
35  
36 # Make all help types available, sans the redundant "help-" prefix
37 0 for my $type (keys %{ $this->{'HELP_TYPES'} }) {
38 0 $this->use_help_type($type);
39 0 ▶ $this->{'HELP_TYPES'}{$type}{OPTION_NAME} ||= $type;
Condition0%0/3
$this->{"HELP_TYPES"}{$type}{"OPTION_NAME"} ||= $type
l!l&&r!l&&!r
000
MC/DC0%0/2
$this->{"HELP_TYPES"}{$type}{"OPTION_NAME"} ||= $type
$this->{"HELP_TYPES"}{$type}{"OPTION_NAME"} $type
Truth table0%0/3
A ||= B
A= $this->{"HELP_TYPES"}{$type}{"OPTION_NAME"}B= $type
ABresult
1X1
011
000
40 }
41 }
42  
43 0 ▶sub init {
Subroutine init: not called CC=2 SCAR=17.9
Pod undocumented
44 0 my $this = shift;
45 0 my $args = shift;
46 0 $this->parse_options($args, {});
47  
48 0 my $op = shift @$args;
49 0 ▶ if ($op) {
Branch: 1 branch
BranchTrueFalseTotal
if ($op) { } 0 0 0
50 # Command help
51 0 local @ARGV = ("--help");
52 0 App::RecordStream::Operation::main("recs-$op");
53 } else {
54 # Option help
55 0 $this->_set_wants_help(1);
56 }
57 }
58  
59 0 ▶sub does_record_output { 0 }
Subroutine does_record_output: not called CC=1 SCAR=6.9
Pod undocumented
60 0 ▶sub wants_input { 0 }
Subroutine wants_input: not called CC=1 SCAR=6.9
Pod undocumented
61 0 ▶sub accept_line {
Subroutine accept_line: not called CC=1 SCAR=6.9
Pod undocumented
62 0 croak "This operation does not accept input.";
63 }
64  
65 1 1;
« blib/lib/App/RecordStream/Operation/toprettyprint.pm ↑ Summary blib/lib/App/RecordStream/InputStream.pm »