[pve-devel] [PATCH pve-manager 2/3] remove dependency on Term::ReadLine (see #2077)

Stefan Hrdlicka s.hrdlicka at proxmox.com
Mon May 9 09:30:33 CEST 2022


depends on change in pve-common

Signed-off-by: Stefan Hrdlicka <s.hrdlicka at proxmox.com>
---
 PVE/CLI/pvenode.pm | 12 ++++--------
 debian/control     |  1 -
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/PVE/CLI/pvenode.pm b/PVE/CLI/pvenode.pm
index acef6c3b..383e1f81 100644
--- a/PVE/CLI/pvenode.pm
+++ b/PVE/CLI/pvenode.pm
@@ -22,8 +22,6 @@ use PVE::CLIFormatter;
 use PVE::RESTHandler;
 use PVE::CLIHandler;
 
-use Term::ReadLine;
-
 use base qw(PVE::CLIHandler);
 
 my $nodename = PVE::INotify::nodename();
@@ -93,13 +91,12 @@ __PACKAGE__->register_method({
 	    }
 	    print $i, ") Custom\n";
 
-	    my $term = Term::ReadLine->new('pvenode');
 	    my $get_dir_selection = sub {
-		my $selection = $term->readline("Enter selection: ");
-		if ($selection =~ /^(\d+)$/) {
+		my $selection = PVE::PTY::read_input("Enter selection: ");
+		if ($selection =~ /^([0-9]+)$/) {
 		    $selection = $1;
 		    if ($selection == $i) {
-			$param->{directory} = $term->readline("Enter custom URL: ");
+			$param->{directory} = PVE::PTY::read_input("Enter custom URL: ");
 			return;
 		    } elsif ($selection < $i && $selection >= 0) {
 			$param->{directory} = $directories->[$selection]->{url};
@@ -120,8 +117,7 @@ __PACKAGE__->register_method({
 	my $tos = PVE::API2::ACMEAccount->get_tos({ directory => $param->{directory} });
 	if ($tos) {
 	    print "Terms of Service: $tos\n";
-	    my $term = Term::ReadLine->new('pvenode');
-	    my $agreed = $term->readline('Do you agree to the above terms? [y|N]: ');
+	    my $agreed = PVE::PTY::read_input('Do you agree to the above terms? [y|N]: ');
 	    die "Cannot continue without agreeing to ToS, aborting.\n"
 		if ($agreed !~ /^y$/i);
 
diff --git a/debian/control b/debian/control
index f48a38d0..6bb442fd 100644
--- a/debian/control
+++ b/debian/control
@@ -62,7 +62,6 @@ Depends: apt-transport-https | apt (>= 1.5~),
          libpve-storage-perl (>= 7.1-2),
          librados2-perl,
          libtemplate-perl,
-         libterm-readline-gnu-perl,
          liburi-perl,
          libuuid-perl,
          libwww-perl (>= 6.04-1),
-- 
2.30.2





More information about the pve-devel mailing list