| 1 | package App::BCSSH::Help; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use App::BCSSH::Util qw(command_to_package package_to_command); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | has opt_help => (is => 'ro', arg_spec => 'help'); | |||||||||||||||||||||||||||
| 6 | 1 | has opt_help_short => (is => 'ro', arg_spec => 'h'); | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 0 | ▶ | around run => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 9 | 0 | my $orig = shift; | |||||||||||||||||||||||||||
| 10 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 11 | 0 | ▶ | if ($self->opt_help_short) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 12 | 0 | my $package = ref $self; | |||||||||||||||||||||||||||
| 13 | 0 | require App::BCSSH; | |||||||||||||||||||||||||||
| 14 | 0 | require App::BCSSH::Pod; | |||||||||||||||||||||||||||
| 15 | 0 | my $parsed = App::BCSSH::Pod->parse($package); | |||||||||||||||||||||||||||
| 16 | 0 | my ($abstract, $synopsis, $options) = @{$parsed}{qw(abstract synopsis options)}; | |||||||||||||||||||||||||||
| 17 | 0 | my $command = package_to_command($package); | |||||||||||||||||||||||||||
| 18 | 0 | printf "bcssh %0.6f\n", $App::BCSSH::VERSION; | |||||||||||||||||||||||||||
| 19 | 0 | print "bcssh $command"; | |||||||||||||||||||||||||||
| 20 | 0 | ▶ | print " - $abstract" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | if $abstract; | ||||||||||||||||||||||||||||
| 22 | 0 | print "\n"; | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | print "\nSynopsis:\n$synopsis\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | if $synopsis; | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($options && %$options) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$options and %$options
MC/DC0%0/2
$options and %$options
$options
%$options
Truth table0%0/3
A and B
A= $optionsB= %$options
| |||||||||||||||||||||||||||||
| 27 | 0 | print "\nOptions:\n"; | |||||||||||||||||||||||||||
| 28 | 0 | for my $option (sort keys %$options) { | |||||||||||||||||||||||||||
| 29 | 0 | my $short = $options->{$option}; | |||||||||||||||||||||||||||
| 30 | 0 | $short =~ s/\..*/./; | |||||||||||||||||||||||||||
| 31 | 0 | printf "%15s : %s\n", $option, $short; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | 0 | return 1; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | elsif ($self->opt_help) { | ||||||||||||||||||||||||||||
| 37 | 0 | my $package = ref $self; | |||||||||||||||||||||||||||
| 38 | 0 | require App::BCSSH::Command::help; | |||||||||||||||||||||||||||
| 39 | 0 | return App::BCSSH::Command::help->new->help_for_package($package); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | 0 | return $self->$orig(@_); | |||||||||||||||||||||||||||
| 42 | 1 | }; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | 1; | |||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||