lib/WWW/Hetzner/CLI/Cmd/Volume/Cmd/Describe.pm

filter: Statementstmt 94.4% 34 / 36 Branchbran 50.0% 3 / 6 Conditioncond 46.1% 6 / 13 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 70.5% 48 / 68 CC 11 SCAR 23.6
CC
11
Cov
78%
execute
14.0
BEGIN
1.0
BEGIN
1.0
CRAP 10.6
« lib/WWW/Hetzner/Robot/API/Traffic.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/FloatingIp/Cmd/List.pm »
1 package WWW::Hetzner::CLI::Cmd::Volume::Cmd::Describe;
2 # ABSTRACT: Describe a volume
3  
4 1 our $VERSION = '0.102';
5  
6 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use MooX::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooX::Options protect_argv => 0, usage_string => 'USAGE: hcloud.pl volume describe <id>';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use JSON::MaybeXS qw(encode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶sub execute {
Subroutine execute: called CC=11 SCAR=26.4
Pod undocumented
12 1 my ($self, $args, $chain) = @_;
13 1 ▶ my $id = $args->[0] or die "Usage: hcloud.pl volume describe <id>\n";
Branch: 1 branch
BranchTrueFalseTotal
my $id = $args->[0] or die "Usage: hcloud.pl volume describe <id>\n" 1 0 1
14  
15 1 my $main = $chain->[0];
16 1 my $cloud = $main->cloud;
17  
18 1 my $volume = $cloud->volumes->get($id);
19  
20 1 ▶ if ($main->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($main->output eq "json") 0 1 1
21 0 print encode_json($volume->data), "\n";
22 0 return;
23 }
24  
25 1 printf "ID: %s\n", $volume->id;
26 1 printf "Name: %s\n", $volume->name;
27 1 printf "Size: %s GB\n", $volume->size;
28 1 printf "Status: %s\n", $volume->status;
29 1 ▶ printf "Location: %s\n", $volume->location // '-';
Condition50%1/2
$volume->location // "-"
l!l
10
MC/DC0%0/1
$volume->location // "-"
$volume->location
Truth table50%1/2
A
A= $volume->location
Aresult
11
00
30 1 ▶ printf "Server: %s\n", $volume->server // 'not attached';
Condition50%1/2
$volume->server // "not attached"
l!l
01
MC/DC0%0/1
$volume->server // "not attached"
$volume->server
Truth table50%1/2
A
A= $volume->server
Aresult
11
00
31 1 ▶ printf "Linux Device: %s\n", $volume->linux_device // '-';
Condition50%1/2
$volume->linux_device // "-"
l!l
10
MC/DC0%0/1
$volume->linux_device // "-"
$volume->linux_device
Truth table50%1/2
A
A= $volume->linux_device
Aresult
11
00
32 1 ▶ printf "Format: %s\n", $volume->format // '-';
Condition50%1/2
$volume->format // "-"
l!l
10
MC/DC0%0/1
$volume->format // "-"
$volume->format
Truth table50%1/2
A
A= $volume->format
Aresult
11
00
33 1 ▶ printf "Created: %s\n", $volume->created // '-';
Condition50%1/2
$volume->created // "-"
l!l
10
MC/DC0%0/1
$volume->created // "-"
$volume->created
Truth table50%1/2
A
A= $volume->created
Aresult
11
00
34  
35 1 my $labels = $volume->labels;
36 1 ▶ if ($labels && %$labels) {
Branch: 1 branch
BranchTrueFalseTotal
if ($labels and %$labels) 1 0 1
Condition33%1/3
$labels and %$labels
!ll&&!rl&&r
001
MC/DC0%0/2
$labels and %$labels
$labels %$labels
Truth table33%1/3
A and B
A= $labelsB= %$labels
ABresult
0X0
100
111
37 1 print "Labels:\n";
38 1 for my $k (sort keys %$labels) {
39 1 printf " %s: %s\n", $k, $labels->{$k};
40 }
41 }
42 }
43  
44 1 1;
45  
46 __END__
« lib/WWW/Hetzner/Robot/API/Traffic.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/FloatingIp/Cmd/List.pm »