« lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/Create.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/Record/Cmd/Create.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::Sshkey; | ||||||||||||
| 2 | # ABSTRACT: SSH key 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 sshkey <command> [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=5 SCAR=16.4
Pod
undocumented
| |||||||||||||
| 13 | 2 | my ($self, $args, $chain) = @_; | |||||||||||
| 14 | |||||||||||||
| 15 | # Default to list | ||||||||||||
| 16 | 2 | my $main = $chain->[0]; | |||||||||||
| 17 | 2 | my $cloud = $main->cloud; | |||||||||||
| 18 | 2 | my $keys = $cloud->ssh_keys->list_all; | |||||||||||
| 19 | |||||||||||||
| 20 | 2 | ▶ | if ($main->output eq 'json') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | 1 | print encode_json([ map { $_->data } @$keys ]), "\n"; | |||||||||||
| 22 | 1 | return; | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 1 | ▶ | if (!@$keys) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 26 | 0 | print "No SSH keys found.\n"; | |||||||||||
| 27 | 0 | return; | |||||||||||
| 28 | } | ||||||||||||
| 29 | |||||||||||||
| 30 | 1 | printf "%-10s %-30s %s\n", 'ID', 'NAME', 'FINGERPRINT'; | |||||||||||
| 31 | 1 | print "-" x 80, "\n"; | |||||||||||
| 32 | |||||||||||||
| 33 | 1 | for my $k (@$keys) { | |||||||||||
| 34 | 1 | ▶ | printf "%-10s %-30s %s\n", | ||||||||||
|
Condition50%1/2
$k->fingerprint // "-"
MC/DC0%0/1
$k->fingerprint // "-"
$k->fingerprint
Truth table50%1/2
A
A= $k->fingerprint
| |||||||||||||
| 35 | $k->id, | ||||||||||||
| 36 | $k->name, | ||||||||||||
| 37 | $k->fingerprint // '-'; | ||||||||||||
| 38 | } | ||||||||||||
| 39 | } | ||||||||||||
| 40 | |||||||||||||
| 41 | 2 | 1; | |||||||||||
| 42 | |||||||||||||
| 43 | __END__ | ||||||||||||