]>
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
::config
;
10 use PVE
::APIClient
::Commands
::remote
;
14 use base
qw(PVE::CLIHandler);
16 __PACKAGE__-
>register_method ({
20 description
=> "Print usage information.",
22 additionalProperties
=> 0,
25 description
=> "Verbose output - list all options.",
32 returns
=> { type
=> 'null'},
36 my $text = "USAGE: pveclient <cmd> ...\n\n" if !$param->{verbose
};
38 my $format = $param->{verbose
} ?
'full' : 'short';
40 my $assemble_usage_string = sub {
41 my ($subcommand, $def) = @_;
43 my $sortfunc = sub { sort keys %{$_[0]} };
45 if (ref($def) eq 'HASH') {
46 foreach my $cmd (&$sortfunc($def)) {
48 if (ref($def->{$cmd}) eq 'ARRAY') {
49 my ($class, $name, $arg_param, $fixed_param) = @{$def->{$cmd}};
50 $text .= $class->usage_str($name, "pveclient $subcommand $name", $arg_param, $fixed_param, $format, $class->can('read_password'));
54 my ($class, $name, $arg_param, $fixed_param) = @$def;
55 $text .= $class->usage_str($name, "pveclient $name", $arg_param, $fixed_param, $format);
59 $assemble_usage_string->('help', $PVE::APIClient
::Commands
::help
::cmddef
);
60 $assemble_usage_string->('list', $PVE::APIClient
::Commands
::list
::cmddef
);
61 $assemble_usage_string->('lxc', $PVE::APIClient
::Commands
::lxc
::cmddef
);
62 $assemble_usage_string->('remote', $PVE::APIClient
::Commands
::remote
::cmddef
);
63 $assemble_usage_string->('config', $PVE::APIClient
::Commands
::config
::cmddef
);
65 $text .= "pveclient <get/set/create/delete> <path> {options}\n\n";
72 our $cmddef = [ __PACKAGE__
, 'help', []];