mirror of
https://git.proxmox.com/git/pve-guest-common
synced 2025-04-30 12:17:58 +00:00
refactor print_pending_delete slightly
while this was much better than the old mess from parse_pending_delete it still was a bit much nested into one line. split that up a bit, add a render_key helper which does the clunky "add !" check and just call that one in the map {} Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c29213f0ef
commit
51088c75f2
@ -92,7 +92,14 @@ sub parse_pending_delete {
|
|||||||
|
|
||||||
sub print_pending_delete {
|
sub print_pending_delete {
|
||||||
my ($class, $delete_hash) = @_;
|
my ($class, $delete_hash) = @_;
|
||||||
join ",", map { ( $delete_hash->{$_}->{force} ? '!' : '' ) . $_ } keys %$delete_hash;
|
|
||||||
|
my $render_key = sub {
|
||||||
|
my $key = shift;
|
||||||
|
$key = "!$key" if $delete_hash->{$key}->{force};
|
||||||
|
return $key;
|
||||||
|
};
|
||||||
|
|
||||||
|
join (',', map { $render_key->($_) } keys %$delete_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub add_to_pending_delete {
|
sub add_to_pending_delete {
|
||||||
|
Loading…
Reference in New Issue
Block a user