mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-01-06 21:17:37 +03:00
cli handler: fix "return" statement followed by "sort" critic
As that's undefined behavior if the containing sub is called in scalar context. https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::ProhibitReturnSort Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
b66eddb7ff
commit
646a36efce
@ -350,7 +350,7 @@ sub print_usage_short {
|
||||
|
||||
print {$fd} generate_usage_str('short', $cmd, ' ' x 7, $cmd ? '' : "\n", sub {
|
||||
my ($h) = @_;
|
||||
return sort {
|
||||
my @sorted_commands = sort {
|
||||
if (ref($h->{$a}) eq 'ARRAY' && ref($h->{$b}) eq 'ARRAY') {
|
||||
# $a and $b are both real commands order them by their class
|
||||
return $h->{$a}->[0] cmp $h->{$b}->[0] || $a cmp $b;
|
||||
@ -362,6 +362,7 @@ sub print_usage_short {
|
||||
return $a cmp $b;
|
||||
}
|
||||
} keys %$h;
|
||||
return @sorted_commands;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user