lib/WWW/Hetzner/CLI/Cmd/Servertype.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 97.2% 35 / 36 CC 4 SCAR 9.2
CC
4
Cov
100%
execute
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« lib/WWW/Hetzner/CLI/Cmd/Datacenter.pm ↑ Summary lib/WWW/Hetzner/Robot/API/Reset.pm »
1 package WWW::Hetzner::CLI::Cmd::Servertype;
2 # ABSTRACT: Server type commands
3  
4 2 our $VERSION = '0.102';
5  
6 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use MooX::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use MooX::Options usage_string => 'USAGE: hcloud.pl servertype [options]';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use JSON::MaybeXS qw(encode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶sub execute {
Subroutine execute: called CC=4 SCAR=13.9
Pod undocumented
12 2 my ($self, $args, $chain) = @_;
13  
14 2 my $main = $chain->[0];
15 2 my $cloud = $main->cloud;
16 2 my $types = $cloud->server_types->list_all;
17  
18 2 ▶ if ($main->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($main->output eq "json") 1 1 2
19 1 print encode_json([ map { $_->data } @$types ]), "\n";
20 1 return;
21 }
22  
23 1 printf "%-10s %-12s %-8s %-10s %-10s %s\n",
24 'ID', 'NAME', 'CORES', 'MEMORY', 'DISK', 'DEPRECATED';
25 1 print "-" x 70, "\n";
26  
27 1 for my $t (@$types) {
28 3 ▶ printf "%-10s %-12s %-8s %-10s %-10s %s\n",
Branch: 1 branch
BranchTrueFalseTotal
$t->deprecated ? : 1 2 3
29 $t->id,
30 $t->name,
31 $t->cores,
32 $t->memory . ' GB',
33 $t->disk . ' GB',
34 $t->deprecated ? 'yes' : '-';
35 }
36 }
37  
38 2 1;
39  
40 __END__
« lib/WWW/Hetzner/CLI/Cmd/Datacenter.pm ↑ Summary lib/WWW/Hetzner/Robot/API/Reset.pm »