]> git.proxmox.com Git - pve-common.git/commitdiff
cli: only show subcommand specific usage if command incomplete
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 13 Jun 2018 07:37:51 +0000 (09:37 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 14 Jun 2018 06:58:54 +0000 (08:58 +0200)
before:
$ pveum acl
ERROR: incomplete command 'pveum acl'
USAGE: pveum <COMMAND> [ARGS] [OPTIONS]
       pveum acl delete <path> --roles <string> [OPTIONS]
       pveum acl modify <path> --roles <string> [OPTIONS]

       pveum group add <groupid> [OPTIONS]
       pveum group delete <groupid>
       pveum group modify <groupid> [OPTIONS]

       pveum role add <roleid> [OPTIONS]
       pveum role delete <roleid>
       pveum role modify <roleid> --privs <string> [OPTIONS]

       pveum user add <userid> [OPTIONS]
       pveum user delete <userid>
       pveum user modify <userid> [OPTIONS]

       pveum passwd <userid>
       pveum ticket <username> [OPTIONS]

       pveum help [<extra-args>] [OPTIONS]

after:
$ pveum acl
ERROR: incomplete command 'pveum acl'
USAGE: pveum <COMMAND> [ARGS] [OPTIONS]
       pveum acl delete <path> --roles <string> [OPTIONS]
       pveum acl modify <path> --roles <string> [OPTIONS]

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

index 49a459ba26299877c3d2abcd53feb0085c50eb65..489ff979798fd63b1078f95bcaaceb375d5b0c75 100644 (file)
@@ -491,7 +491,7 @@ my $handle_cmd  = sub {
     }
 
     # checked special commands, if def is still a hash we got an incomplete sub command
-    $abort->("incomplete command '$cmd_str'") if ref($def) eq 'HASH';
+    $abort->("incomplete command '$cmd_str'", $args) if ref($def) eq 'HASH';
 
     &$preparefunc() if $preparefunc;