lib/WWW/Hetzner/Robot/CLI/Cmd/Server/Cmd/Describe.pm

filter: Statementstmt 89.6% 26 / 29 Branchbran 50.0% 3 / 6 Conditioncond 50.0% 8 / 16 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 64.0% 41 / 64 CC 12 SCAR 26.9
CC
12
Cov
73%
execute
18.2
BEGIN
1.0
BEGIN
1.0
CRAP 14.7
« lib/WWW/Hetzner/Robot/CLI/Cmd/Boot/Cmd/Windows.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/List.pm »
1 package WWW::Hetzner::Robot::CLI::Cmd::Server::Cmd::Describe;
2 # ABSTRACT: Describe a dedicated server
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: hrobot.pl server describe <server-number> [options]';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 1 ▶sub execute {
Subroutine execute: called CC=12 SCAR=29.0
Pod undocumented
12 1 my ($self, $args, $chain) = @_;
13 1 my $root = $chain->[0];
14 1 my $robot = $root->robot;
15  
16 1 ▶ my $server_number = $args->[0] or die "Usage: hrobot.pl server describe <server-number>\n";
Branch: 1 branch
BranchTrueFalseTotal
my $server_number = $args->[0] or die "Usage: hrobot.pl server describe <server-number>\n" 1 0 1
17  
18 1 my $s = $robot->servers->get($server_number);
19  
20 1 ▶ if ($root->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($root->output eq 'json') { } 0 1 1
21 0 require JSON::MaybeXS;
22 0 print JSON::MaybeXS::encode_json({
23 server_number => $s->server_number,
24 server_name => $s->server_name,
25 server_ip => $s->server_ip,
26 product => $s->product,
27 dc => $s->dc,
28 status => $s->status,
29 traffic => $s->traffic,
30 cancelled => $s->cancelled,
31 paid_until => $s->paid_until,
32 });
33 0 print "\n";
34 } else {
35 1 ▶ print "Server Number: ", $s->server_number // '', "\n";
Condition50%1/2
$s->server_number // ""
l!l
10
MC/DC0%0/1
$s->server_number // ""
$s->server_number
Truth table50%1/2
A
A= $s->server_number
Aresult
11
00
36 1 ▶ print "Name: ", $s->server_name // '', "\n";
Condition50%1/2
$s->server_name // ""
l!l
10
MC/DC0%0/1
$s->server_name // ""
$s->server_name
Truth table50%1/2
A
A= $s->server_name
Aresult
11
00
37 1 ▶ print "IP: ", $s->server_ip // '', "\n";
Condition50%1/2
$s->server_ip // ""
l!l
10
MC/DC0%0/1
$s->server_ip // ""
$s->server_ip
Truth table50%1/2
A
A= $s->server_ip
Aresult
11
00
38 1 ▶ print "Product: ", $s->product // '', "\n";
Condition50%1/2
$s->product // ""
l!l
10
MC/DC0%0/1
$s->product // ""
$s->product
Truth table50%1/2
A
A= $s->product
Aresult
11
00
39 1 ▶ print "Datacenter: ", $s->dc // '', "\n";
Condition50%1/2
$s->dc // ""
l!l
10
MC/DC0%0/1
$s->dc // ""
$s->dc
Truth table50%1/2
A
A= $s->dc
Aresult
11
00
40 1 ▶ print "Status: ", $s->status // '', "\n";
Condition50%1/2
$s->status // ""
l!l
10
MC/DC0%0/1
$s->status // ""
$s->status
Truth table50%1/2
A
A= $s->status
Aresult
11
00
41 1 ▶ print "Traffic: ", $s->traffic // '', "\n";
Condition50%1/2
$s->traffic // ""
l!l
10
MC/DC0%0/1
$s->traffic // ""
$s->traffic
Truth table50%1/2
A
A= $s->traffic
Aresult
11
00
42 1 ▶ print "Cancelled: ", $s->cancelled ? 'yes' : 'no', "\n";
Branch: 1 branch
BranchTrueFalseTotal
$s->cancelled ? : 0 1 1
43 1 ▶ print "Paid Until: ", $s->paid_until // '', "\n";
Condition50%1/2
$s->paid_until // ""
l!l
10
MC/DC0%0/1
$s->paid_until // ""
$s->paid_until
Truth table50%1/2
A
A= $s->paid_until
Aresult
11
00
44 }
45 }
46  
47 1 1;
48  
49 __END__
« lib/WWW/Hetzner/Robot/CLI/Cmd/Boot/Cmd/Windows.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/List.pm »