]> git.proxmox.com Git - pve-common.git/commitdiff
cli: use exists() for alias check
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 14 Jun 2018 07:02:46 +0000 (09:02 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 14 Jun 2018 07:02:47 +0000 (09:02 +0200)
should be faster

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/CLIHandler.pm

index 489ff979798fd63b1078f95bcaaceb375d5b0c75..a7ced38a41ccd04662297d8d5d0ab0c6c74a1bf7 100644 (file)
@@ -54,7 +54,7 @@ my $expand_command_name = sub {
 
     return $cmd if exists $def->{$cmd}; # command is already complete
 
-    my $is_alias = sub { ref($_[0]) eq 'HASH' && $_[0]->{alias} };
+    my $is_alias = sub { ref($_[0]) eq 'HASH' && exists($_[0]->{alias}) };
     my @expanded = grep { /^\Q$cmd\E/ && !$is_alias->($def->{$_}) } keys %$def;
 
     return $expanded[0] if scalar(@expanded) == 1; # enforce exact match