| 1 | package Beam::Runner::Command::help; | ||||||||||||||||||||||||||||
| 2 | 2 | our $VERSION = '0.016'; | |||||||||||||||||||||||||||
| 3 | # ABSTRACT: Get help for the given service(s) | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | #pod =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 6 | #pod | ||||||||||||||||||||||||||||
| 7 | #pod beam help <container> <service> | ||||||||||||||||||||||||||||
| 8 | #pod | ||||||||||||||||||||||||||||
| 9 | #pod =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 10 | #pod | ||||||||||||||||||||||||||||
| 11 | #pod Show the documentation for the given service from the given container. | ||||||||||||||||||||||||||||
| 12 | #pod | ||||||||||||||||||||||||||||
| 13 | #pod =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 14 | #pod | ||||||||||||||||||||||||||||
| 15 | #pod L<beam>, L<Beam::Runner::Command>, L<Beam::Runner> | ||||||||||||||||||||||||||||
| 16 | #pod | ||||||||||||||||||||||||||||
| 17 | #pod =cut | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use Beam::Runner::Util qw( find_container_path ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use Pod::Usage qw( pod2usage ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use Pod::Find qw( pod_where ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 2 | ▶ | use Beam::Wire; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 6 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 6 | my ( $class, $container, $service_name ) = @_; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 6 | ▶ | if ( !$container || !$service_name ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$container and $service_name
MC/DC100%2/2
$container and $service_name
$container
$service_name
Truth table100%3/3
A and B
A= $containerB= $service_name
| |||||||||||||||||||||||||||||
| 30 | 2 | return pod2usage( | |||||||||||||||||||||||||||
| 31 | -message => 'ERROR: <container> and <service> are required', | ||||||||||||||||||||||||||||
| 32 | -input => pod_where( { -inc => 1 }, __PACKAGE__ ), | ||||||||||||||||||||||||||||
| 33 | -verbose => 0, | ||||||||||||||||||||||||||||
| 34 | -exitval => 1, | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 4 | my $path = find_container_path( $container ); | |||||||||||||||||||||||||||
| 39 | 3 | my $wire = Beam::Wire->new( | |||||||||||||||||||||||||||
| 40 | file => $path, | ||||||||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||||||||
| 42 | 3 | my $service_conf = $wire->get_config( $service_name ); | |||||||||||||||||||||||||||
| 43 | 3 | ▶ | die sprintf qq{Could not find service "%s" in container "%s"\n}, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | $service_name, $path | ||||||||||||||||||||||||||||
| 45 | unless $service_conf; | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 2 | my %service_conf = %{ $wire->normalize_config( $service_conf ) }; | |||||||||||||||||||||||||||
| 48 | 2 | %service_conf = $wire->merge_config( %service_conf ); | |||||||||||||||||||||||||||
| 49 | 2 | my $pod_path = pod_where( { -inc => 1 }, $service_conf{class} ); | |||||||||||||||||||||||||||
| 50 | 2 | ▶ | if ( !$pod_path ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 1 | die "Could not find documentation for class '$service_conf{class}'\n"; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | pod2usage( | ||||||||||||||||||||||||||||
| 54 | 1 | -input => $pod_path, | |||||||||||||||||||||||||||
| 55 | -verbose => 2, | ||||||||||||||||||||||||||||
| 56 | -exitval => 0, | ||||||||||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 2 | 1; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||||||||||