texlive[43802] Master/texmf-dist/scripts/texlive/tlmgr.pl: support
commits+preining at tug.org
commits+preining at tug.org
Sat Apr 15 02:14:53 CEST 2017
Revision: 43802
http://tug.org/svn/texlive?view=revision&revision=43802
Author: preining
Date: 2017-04-15 02:14:53 +0200 (Sat, 15 Apr 2017)
Log Message:
-----------
support forced arguments in standard prompts, no bold
Modified Paths:
--------------
trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
Modified: trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl 2017-04-15 00:14:46 UTC (rev 43801)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl 2017-04-15 00:14:53 UTC (rev 43802)
@@ -6504,12 +6504,11 @@
# tlmgr shell code
sub action_shell {
my $protocol = 1;
+ our $promptfunc;
eval {
require IO::Prompter;
};
-
- our $promptfunc;
if ($@) {
printf STDERR "Cannot find IO::Prompter module, reduced interactive functionality!\n";
$promptfunc = sub {
@@ -6517,6 +6516,7 @@
my $prompt = "";
my @options;
my @guarantee;
+ my @savedargs = @_;
while (defined(my $arg = shift @_)) {
if ($arg =~ m/^-prompt$/) {
$prompt .= shift @_;
@@ -6541,9 +6541,23 @@
print "(", join(",", @options), ") ";
}
my $ans = <STDIN>;
+ if (!defined($ans)) {
+ # we got Ctrl-D, just break out
+ return;
+ }
chomp($ans);
if (@guarantee) {
- # TODO TODO TODO
+ my $isok = 0;
+ for my $g (@guarantee) {
+ if ($ans eq $g) {
+ $isok = 1;
+ last;
+ }
+ }
+ if (!$isok) {
+ print("Please answer one of @guarantee!\n");
+ return($promptfunc->(@savedargs));
+ }
}
return($ans);
}
@@ -6560,10 +6574,11 @@
while (1) {
# print $prompt;
# my $ans = <STDIN>;
- my $ans = do_prompt('tlmgr>', -style => 'bold');
+ my $ans = do_prompt('tlmgr>');
# chomp $ans;
+ next if (!defined($ans));
my ($cmd, @args) = TeXLive::TLUtils::quotewords('\s+', 0, $ans);
- next if (!$cmd);
+ next if (!defined($cmd));
if ($cmd eq "protocol") {
print "protocol $protocol\n";
} elsif ($cmd eq "version") {
@@ -6595,6 +6610,9 @@
$val = do_prompt('Enter 1 for on, 0 for off:', -guarantee => [0,1]);
}
}
+ # deal with Ctrl-D
+ next if (!defined($val));
+
if ($key eq "repository") {
if ($cmd eq "set") {
$location = scalar($val);
More information about the tex-live-commits
mailing list