]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/CLIHandler.pm
fix #2696: avoid 'undefined value' warning in 'pvesh help unknown'
[pve-common.git] / src / PVE / CLIHandler.pm
index 249c7cc541ceb5bcc0ae8954c4e7a15b3abc3f6c..9955d77e06395c85dd219dac7d9f322bc1824992 100644 (file)
@@ -235,8 +235,8 @@ sub generate_usage_str {
 
            }
        } else {
+           $abort->("unknown command '$cmd->[0]'") if !$def;
            my ($class, $name, $arg_param, $fixed_param, undef, $formatter_properties) = @$def;
-           $abort->("unknown command '$cmd'") if !$class;
 
            $str .= $indent;
            $str .= $class->usage_str($name, $prefix, $arg_param, $fixed_param, $format, $param_cb, $formatter_properties);
@@ -519,7 +519,7 @@ function _$exename() {
     cmd=\${words[1]}
     curr=\${words[cwords]}
     prev=\${words[cwords-1]}
-    compadd \$(COMP_CWORD="\$cwords" COMP_LINE="\$line" COMP_POINT="\$point" \\
+    compadd -- \$(COMP_CWORD="\$cwords" COMP_LINE="\$line" COMP_POINT="\$point" \\
        $exename bashcomplete "\$cmd" "\$curr" "\$prev")
 }
 __EOD__