lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Update.pm

filter: Statementstmt 92.0% 23 / 25 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 85.7% 30 / 35 CC 3 SCAR 6.7
CC
3
Cov
86%
execute
3.2
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« lib/WWW/Hetzner/CLI/Cmd/Firewall/Cmd/ApplyTo.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/Location.pm »
1 package WWW::Hetzner::CLI::Cmd::StorageBox::Cmd::Update;
2 # ABSTRACT: Update a Storage Box
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 storage-box update --name <name> <storage-box>';
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 option name => ( is => 'ro', format => 's', required => 1, doc => 'New Storage Box name' );
12  
13 1 ▶sub execute {
Subroutine execute: called CC=3 SCAR=11.7
Pod undocumented
14 1 my ($self, $args, $chain) = @_;
15 1 ▶ my $id = $args->[0] or die "Usage: hcloud.pl storage-box update --name <name> <storage-box>\n";
Branch: 1 branch
BranchTrueFalseTotal
my $id = $args->[0] or die "Usage: hcloud.pl storage-box update --name <name> <storage-box>\n" 1 0 1
16 1 my $main = $chain->[0];
17 1 my $box = $main->storage->storage_boxes->update($id, name => $self->name);
18 1 ▶ if ($main->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($main->output eq "json") 0 1 1
19 0 print encode_json($box->data), "\n";
20 0 return;
21 }
22 1 print "Storage Box updated:\n";
23 1 printf " ID: %s\n", $box->id;
24 1 printf " Name: %s\n", $box->name;
25 }
26  
27 1 1;
28  
29 __END__
« lib/WWW/Hetzner/CLI/Cmd/Firewall/Cmd/ApplyTo.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/Location.pm »