lib/WWW/Hetzner/Robot/CLI/Cmd/Key.pm

filter: Statementstmt 82.6% 19 / 23 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 4 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 66.6% 28 / 42 CC 7 SCAR 20.2
CC
7
Cov
73%
execute
10.4
BEGIN
1.0
BEGIN
1.0
CRAP 7.5
« lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/UpdateAccessSettings.pm ↑ Summary lib/WWW/Hetzner/Cloud/API/PrimaryIPs.pm »
1 package WWW::Hetzner::Robot::CLI::Cmd::Key;
2 # ABSTRACT: Robot SSH key commands
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 usage_string => 'USAGE: hrobot.pl key [options]';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 1 ▶sub execute {
Subroutine execute: called CC=7 SCAR=23.4
Pod undocumented
12 1 my ($self, $args, $chain) = @_;
13 1 my $root = $chain->[0];
14 1 my $robot = $root->robot;
15  
16 # Default: list keys
17 1 my $keys = $robot->keys->list;
18  
19 1 ▶ if ($root->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($root->output eq 'json') { } 0 1 1
20 0 require JSON::MaybeXS;
21 0 print JSON::MaybeXS::encode_json([map { +{
22 0 name => $_->name,
23 fingerprint => $_->fingerprint,
24 type => $_->type,
25 size => $_->size,
26 } } @$keys]);
27 0 print "\n";
28 } else {
29 1 printf "%-20s %-50s %-10s %s\n", 'NAME', 'FINGERPRINT', 'TYPE', 'SIZE';
30 1 for my $k (@$keys) {
31 2 ▶ printf "%-20s %-50s %-10s %s\n",
Condition50%4/8
$k->name // ""
l!l
20
$k->fingerprint // ""
l!l
20
$k->type // ""
l!l
20
$k->size // ""
l!l
20
MC/DC0%0/1
$k->name // ""
$k->name
MC/DC0%0/1
$k->fingerprint // ""
$k->fingerprint
MC/DC0%0/1
$k->type // ""
$k->type
MC/DC0%0/1
$k->size // ""
$k->size
Truth table50%1/2
A
A= $k->name
Aresult
11
00
Truth table50%1/2
A
A= $k->fingerprint
Aresult
11
00
Truth table50%1/2
A
A= $k->type
Aresult
11
00
Truth table50%1/2
A
A= $k->size
Aresult
11
00
32 $k->name // '',
33 $k->fingerprint // '',
34 $k->type // '',
35 $k->size // '';
36 }
37 }
38 }
39  
40 1 1;
41  
42 __END__
« lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/UpdateAccessSettings.pm ↑ Summary lib/WWW/Hetzner/Cloud/API/PrimaryIPs.pm »