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

filter: Statementstmt 100% 26 / 26 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 91.8% 34 / 37 CC 4 SCAR 9.2
CC
4
Cov
97%
execute
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« lib/WWW/Hetzner/CLI/Cmd/Sshkey/Cmd/Create.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/Servertype.pm »
1 package WWW::Hetzner::CLI::Cmd::Datacenter;
2 # ABSTRACT: Datacenter 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 datacenter [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  
12 2 ▶sub execute {
Subroutine execute: called CC=4 SCAR=13.9
Pod undocumented
13 2 my ($self, $args, $chain) = @_;
14  
15 2 my $main = $chain->[0];
16 2 my $cloud = $main->cloud;
17 2 my $datacenters = $cloud->datacenters->list_all;
18  
19 2 ▶ if ($main->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($main->output eq "json") 1 1 2
20 1 print encode_json([ map { $_->data } @$datacenters ]), "\n";
21 1 return;
22 }
23  
24 1 printf "%-10s %-15s %-30s %s\n", 'ID', 'NAME', 'DESCRIPTION', 'LOCATION';
25 1 print "-" x 80, "\n";
26  
27 1 for my $d (@$datacenters) {
28 3 ▶ printf "%-10s %-15s %-30s %s\n",
Condition50%1/2
$d->location // "-"
l!l
30
MC/DC0%0/1
$d->location // "-"
$d->location
Truth table50%1/2
A
A= $d->location
Aresult
11
00
29 $d->id,
30 $d->name,
31 $d->description,
32 $d->location // '-';
33 }
34 }
35  
36  
37 2 1;
38  
39 __END__
« lib/WWW/Hetzner/CLI/Cmd/Sshkey/Cmd/Create.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/Servertype.pm »