]>
git.proxmox.com Git - pve-client.git/blob - PVE/APIClient/Commands/remote.pm
1 package PVE
::APIClient
::Commands
::remote
;
6 use PVE
::JSONSchema
qw(register_standard_option get_standard_option);
7 use PVE
::APIClient
::Config
;
11 use base
qw(PVE::CLIHandler);
13 my $remote_name_regex = qr(\w
+);
15 my $complete_remote_name = sub {
17 my $conf = PVE
::APIClient
::Config
::load_config
();
21 foreach my $k (keys %$conf) {
22 if ($k =~ m/^remote_($remote_name_regex)$/) {
30 register_standard_option
('pveclient-remote-name', {
31 description
=> "The name of the remote.",
33 pattern
=> $remote_name_regex,
34 completion
=> $complete_remote_name,
37 __PACKAGE__-
>register_method ({
41 description
=> "Add a remote to your config file.",
43 additionalProperties
=> 0,
45 name
=> get_standard_option
('pveclient-remote-name', { completion
=> sub {} }),
47 description
=> "The host, either host, host:port or https://host:port",
51 description
=> "The username.",
57 returns
=> { type
=> 'null'},
65 __PACKAGE__-
>register_method ({
69 description
=> "Removes a remote from your config file.",
71 additionalProperties
=> 0,
73 name
=> get_standard_option
('pveclient-remote-name'),
76 returns
=> { type
=> 'null'},
85 add
=> [ __PACKAGE__
, 'add', ['name', 'host']],
86 remove
=> [ __PACKAGE__
, 'remove', ['name']],