[pve-devel] [PATCH pve-client 2/6] register standard option inside PVE::APIClient::Config

Dietmar Maurer dietmar at proxmox.com
Tue Jun 5 12:17:40 CEST 2018


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 PVE/APIClient/Commands/remote.pm | 15 +--------------
 PVE/APIClient/Config.pm          | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/PVE/APIClient/Commands/remote.pm b/PVE/APIClient/Commands/remote.pm
index c9e0e62..5d04e3a 100644
--- a/PVE/APIClient/Commands/remote.pm
+++ b/PVE/APIClient/Commands/remote.pm
@@ -3,7 +3,7 @@ package PVE::APIClient::Commands::remote;
 use strict;
 use warnings;
 
-use PVE::JSONSchema qw(register_standard_option get_standard_option);
+use PVE::JSONSchema qw(get_standard_option);
 use PVE::APIClient::Config;
 
 use PVE::CLIHandler;
@@ -13,19 +13,6 @@ use PVE::PTY ();
 
 use base qw(PVE::CLIHandler);
 
-my $complete_remote_name = sub {
-
-    my $config = PVE::APIClient::Config->new();
-    return $config->remote_names;
-};
-
-register_standard_option('pveclient-remote-name', {
-    description => "The name of the remote.",
-    type => 'string',
-    pattern => qr(\w+),
-    completion => $complete_remote_name,
-});
-
 sub read_password {
    return PVE::PTY::read_password("Remote password: ")
 }
diff --git a/PVE/APIClient/Config.pm b/PVE/APIClient/Config.pm
index 6c5b537..40caed8 100644
--- a/PVE/APIClient/Config.pm
+++ b/PVE/APIClient/Config.pm
@@ -5,8 +5,22 @@ use warnings;
 use JSON;
 
 use File::HomeDir ();
+use PVE::JSONSchema qw(register_standard_option get_standard_option);
 use PVE::Tools qw(file_get_contents file_set_contents);
 
+my $complete_remote_name = sub {
+
+    my $config = PVE::APIClient::Config->new();
+    return $config->remote_names;
+};
+
+register_standard_option('pveclient-remote-name', {
+    description => "The name of the remote.",
+    type => 'string',
+    pattern => qr(\w+),
+    completion => $complete_remote_name,
+});
+
 sub new {
     my ($class) = @_;
 
-- 
2.11.0



More information about the pve-devel mailing list