generate_usage_str: show short usage help for unknown commands
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 13 Jun 2018 06:30:35 +0000 (08:30 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 13 Jun 2018 06:31:25 +0000 (08:31 +0200)
followup for previous commit to show the full short usage string for
the CLI tool in the case of an unknown command

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/CLIHandler.pm

index 5cdffa3..9bbc156 100644 (file)
@@ -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);
        $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 {
 
     my $generate;
     $generate = sub {