| 1 | # ABSTRACT: | ||||||||||||
| 2 | package API::CLI::Cmd; | ||||||||||||
| 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.001_001'; # TRIAL VERSION | |||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | use feature qw/ say /; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 1 | ▶ | use base 'App::Spec::Run::Cmd'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 1 | ▶ | use API::CLI::App::Spec; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 1 | ▶ | use YAML::XS qw/ LoadFile DumpFile Dump /; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | |||||||||||||
| 13 | 0 | ▶ | sub appspec_openapi { | ||||||||||
|
Subroutine
appspec_openapi: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 14 | 0 | my ($self, $run) = @_; | |||||||||||
| 15 | 0 | my $options = $run->options; | |||||||||||
| 16 | 0 | my $parameters = $run->parameters; | |||||||||||
| 17 | |||||||||||||
| 18 | 0 | my $openapi_file = $parameters->{file}; | |||||||||||
| 19 | 0 | my $outfile = $options->{out}; | |||||||||||
| 20 | 0 | ▶ | my $class = $options->{class} || 'API::CLI'; | ||||||||||
|
Condition0%0/2
$options->{'class'} || 'API::CLI'
MC/DC0%0/1
$options->{'class'} || 'API::CLI'
$options->{'class'}
Truth table0%0/2
A
A= $options->{'class'}
| |||||||||||||
| 21 | 0 | my $name = $options->{name}; | |||||||||||
| 22 | |||||||||||||
| 23 | 0 | my $openapi = LoadFile($openapi_file); | |||||||||||
| 24 | |||||||||||||
| 25 | 0 | my $appspec = API::CLI::App::Spec->openapi2appspec( | |||||||||||
| 26 | openapi => $openapi, | ||||||||||||
| 27 | name => $name, | ||||||||||||
| 28 | class => $class, | ||||||||||||
| 29 | ); | ||||||||||||
| 30 | 0 | ▶ | if (defined $outfile) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | 0 | DumpFile($outfile, $appspec); | |||||||||||
| 32 | 0 | say "Wrote appspec to $outfile"; | |||||||||||
| 33 | } | ||||||||||||
| 34 | else { | ||||||||||||
| 35 | 0 | print Dump $appspec; | |||||||||||
| 36 | } | ||||||||||||
| 37 | } | ||||||||||||
| 38 | |||||||||||||
| 39 | 1 | 1; | |||||||||||
| 40 | |||||||||||||
| 41 | __END__ | ||||||||||||