]>
git.proxmox.com Git - pve-client.git/blob - PVE/APIClient/Commands/help.pm
1 package PVE
::APIClient
::Commands
::help
;
6 use PVE
::APIClient
::Commands
::help
;
7 use PVE
::APIClient
::Commands
::list
;
8 use PVE
::APIClient
::Commands
::lxc
;
9 use PVE
::APIClient
::Commands
::remote
;
13 use base
qw(PVE::CLIHandler);
15 __PACKAGE__-
>register_method ({
19 description
=> "Print usage information.",
21 additionalProperties
=> 0,
24 description
=> "Verbose output - list all options.",
31 returns
=> { type
=> 'null'},
35 my $text = "USAGE: pveclient <cmd> ...\n\n" if !$param->{verbose
};
37 my $format = $param->{verbose
} ?
'full' : 'short';
39 my $assemble_usage_string = sub {
40 my ($subcommand, $def) = @_;
42 my $sortfunc = sub { sort keys %{$_[0]} };
44 if (ref($def) eq 'HASH') {
45 foreach my $cmd (&$sortfunc($def)) {
47 if (ref($def->{$cmd}) eq 'ARRAY') {
48 my ($class, $name, $arg_param, $fixed_param) = @{$def->{$cmd}};
49 $text .= $class->usage_str($name, "pveclient $subcommand $name", $arg_param, $fixed_param, $format, $class->can('read_password'));
53 my ($class, $name, $arg_param, $fixed_param) = @$def;
54 $text .= $class->usage_str($name, "pveclient $name", $arg_param, $fixed_param, $format);
58 $assemble_usage_string->('help', $PVE::APIClient
::Commands
::help
::cmddef
);
59 $assemble_usage_string->('list', $PVE::APIClient
::Commands
::list
::cmddef
);
60 $assemble_usage_string->('lxc', $PVE::APIClient
::Commands
::lxc
::cmddef
);
61 $assemble_usage_string->('remote', $PVE::APIClient
::Commands
::remote
::cmddef
);
63 $text .= "pveclient <get/set/create/delete> <path> {options}\n\n";
70 our $cmddef = [ __PACKAGE__
, 'help', []];