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

filter: Statementstmt 96.1% 25 / 26 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 84.6% 33 / 39 CC 4 SCAR 9.5
CC
4
Cov
88%
execute
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.6
« lib/WWW/Hetzner/CLI/Cmd/Volume/Cmd/Create.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/Delete.pm »
1 package WWW::Hetzner::CLI::Cmd::Sshkey::Cmd::Describe;
2 # ABSTRACT: Describe an SSH key
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 sshkey 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=4 SCAR=14.3
Pod undocumented
12 1 my ($self, $args, $chain) = @_;
13 1 ▶ my $id = $args->[0] or die "Usage: hcloud.pl sshkey describe <id>\n";
Branch: 1 branch
BranchTrueFalseTotal
my $id = $args->[0] or die "Usage: hcloud.pl sshkey describe <id>\n" 1 0 1
14  
15 1 my $main = $chain->[0];
16 1 my $cloud = $main->cloud;
17  
18 1 my $key = $cloud->ssh_keys->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($key->data), "\n";
22 } else {
23 1 printf "ID: %s\n", $key->id;
24 1 printf "Name: %s\n", $key->name;
25 1 printf "Fingerprint: %s\n", $key->fingerprint;
26 1 ▶ printf "Created: %s\n", $key->created // '-';
Condition50%1/2
$key->created // "-"
l!l
10
MC/DC0%0/1
$key->created // "-"
$key->created
Truth table50%1/2
A
A= $key->created
Aresult
11
00
27 1 printf "Public Key:\n%s\n", $key->public_key;
28 }
29 }
30  
31 1 1;
32  
33 __END__
« lib/WWW/Hetzner/CLI/Cmd/Volume/Cmd/Create.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/Delete.pm »