[pve-devel] applied: [pve-common] generate_usage_str: do not group sub-commands

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jul 31 11:12:25 CEST 2018


Am 07/31/2018 um 10:38 AM schrieb Dietmar Maurer:
> Usually, sub commands already form a logical group, so further grouping
> just adds confusion (see 'qm' as example)
> 
> Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> ---
>  src/PVE/CLIHandler.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
> index 5c0671f..13904e2 100644
> --- a/src/PVE/CLIHandler.pm
> +++ b/src/PVE/CLIHandler.pm
> @@ -217,7 +217,7 @@ sub generate_usage_str {
>  		} else {
>  		    next if $def->{$cmd}->{alias};
>  
> -		    my $substr = $generate->($indent, $separator, $def->{$cmd}, "$prefix $cmd");
> +		    my $substr = $generate->($indent, '', $def->{$cmd}, "$prefix $cmd");
>  		    if ($substr) {
>  			$substr .= $separator if $substr !~ /\Q$separator\E{2}/;
>  			$str .= $substr;
> @@ -335,7 +335,7 @@ sub print_usage_short {
>      $assert_initialized->();
>  
>      print $fd "ERROR: $msg\n" if $msg;
> -    print $fd "USAGE: $exename <COMMAND> [ARGS] [OPTIONS]\n";
> +    print $fd "USAGE: $exename <COMMAND> [ARGS] [OPTIONS]\n\n";
>  
>      print {$fd} generate_usage_str('short', $cmd, ' ' x 7, "\n", sub {
>  	my ($h) = @_;
> 

applied, thanks! but, just as an observation, if you get the short usage
from a command group, e.g. with:

# qm guest

they are still separated by class there, although there, personally,
this doesn't irks me.




More information about the pve-devel mailing list