| 1 | # ABSTRACT: show the full manual for a command | ||||||||||
| 2 | |||||||||||
| 3 | package App::Pinto::Command::manual; | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use Pod::Usage qw(pod2usage); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use base qw(App::Pinto::Command); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | #------------------------------------------------------------------------------- | ||||||||||
| 13 | |||||||||||
| 14 | 1 | our $VERSION = '0.14'; # VERSION | |||||||||
| 15 | |||||||||||
| 16 | #------------------------------------------------------------------------------- | ||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub command_names { return qw( manual man --man ) } | ||||||||
|
Subroutine
command_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 19 | |||||||||||
| 20 | #----------------------------------------------------------------------------- | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub validate_args { | ||||||||
|
Subroutine
validate_args: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 23 | 0 | my ( $self, $opts, $args ) = @_; | |||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | $self->usage_error("Must specify a command") if @{$args} != 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 0 | return 1; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | #------------------------------------------------------------------------------- | ||||||||||
| 31 | # This was stolen from App::Cmd::Command::help | ||||||||||
| 32 | |||||||||||
| 33 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 34 | 0 | my ( $self, $opts, $args ) = @_; | |||||||||
| 35 | |||||||||||
| 36 | 0 | my ( $cmd, undef, undef ) = $self->app->prepare_command(@$args); | |||||||||
| 37 | |||||||||||
| 38 | 0 | my $class = ref $cmd; | |||||||||
| 39 | |||||||||||
| 40 | # An invalid command name was specified, so the fallback command class | ||||||||||
| 41 | # was returned. Rather than showing the (unhelpful) manual for | ||||||||||
| 42 | # App::Cmd::Command::commands, we will just bail out and let App::Cmd | ||||||||||
| 43 | # show the usual 'unrecognized command' message. | ||||||||||
| 44 | 0 | ▶ | return 1 if $class eq 'App::Cmd::Command::commands'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | |||||||||||
| 46 | 0 | ( my $relative_path = $class ) =~ s< :: ></>xmsg; | |||||||||
| 47 | 0 | $relative_path .= '.pm'; | |||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | my $absolute_path = $INC{$relative_path} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | or die "No manual available for $class\n"; | ||||||||||
| 51 | |||||||||||
| 52 | 0 | pod2usage( -verbose => 2, -input => $absolute_path, -exitval => 0 ); | |||||||||
| 53 | |||||||||||
| 54 | 0 | return 1; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | #------------------------------------------------------------------------------- | ||||||||||
| 58 | 1 | 1; | |||||||||
| 59 | |||||||||||
| 60 | __END__ | ||||||||||