[pve-devel] applied: [PATCH pve-common] generate_usage_str: do no generate help for unknown commands

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jun 13 08:30:07 CEST 2018


On 6/13/18 8:00 AM, Dietmar Maurer wrote:
> Before:
> 
> ...
> USAGE: pvesm aaa zfsscan
> 
> With this patch applied:
> 
> no such command 'aaa'
> 

applied, thanks. I followed up with:

diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
index 5cdffa3..9bbc156 100644
--- a/src/PVE/CLIHandler.pm
+++ b/src/PVE/CLIHandler.pm
@@ -132,7 +132,7 @@ sub generate_usage_str {
        $cli_handler_class->can('string_param_file_mapping');

     my ($subcmd, $def, undef, undef, $cmdstr) = resolve_cmd($cmd);
-    die "no such command '$cmd->[0]'\n" if !defined($def) && ref($cmd) eq 'ARRAY';
+    $abort->("unknown command '$cmdstr'") if !defined($def) && ref($cmd) eq 'ARRAY';

     my $generate;
     $generate = sub {

--

to make it show the short usage help in this case



More information about the pve-devel mailing list