]>
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
::lxc
;
8 use PVE
::APIClient
::Commands
::remote
;
12 use base
qw(PVE::CLIHandler);
14 __PACKAGE__-
>register_method ({
18 description
=> "Print usage information.",
20 additionalProperties
=> 0,
23 description
=> "Verbose output - list all options.",
30 returns
=> { type
=> 'null'},
34 my $text = "USAGE: pveclient <cmd> ...\n\n" if !$param->{verbose
};
36 my $format = $param->{verbose
} ?
'full' : 'short';
38 my $assemble_usage_string = sub {
39 my ($subcommand, $def) = @_;
41 my $sortfunc = sub { sort keys %{$_[0]} };
43 if (ref($def) eq 'HASH') {
44 foreach my $cmd (&$sortfunc($def)) {
46 if (ref($def->{$cmd}) eq 'ARRAY') {
47 my ($class, $name, $arg_param, $fixed_param) = @{$def->{$cmd}};
48 $text .= $class->usage_str($name, "pveclient $subcommand $name", $arg_param, $fixed_param, $format);
52 my ($class, $name, $arg_param, $fixed_param) = @$def;
53 $text .= $class->usage_str($name, "pveclient $name", $arg_param, $fixed_param, $format);
57 $assemble_usage_string->('help', $PVE::APIClient
::Commands
::help
::cmddef
);
58 $assemble_usage_string->('lxc', $PVE::APIClient
::Commands
::lxc
::cmddef
);
59 $assemble_usage_string->('remote', $PVE::APIClient
::Commands
::remote
::cmddef
);
61 $text .= "pveclient <get/set/create/delete> <path> {options}\n\n";
68 our $cmddef = [ __PACKAGE__
, 'help', []];