summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2017-04-15 00:14:53 +0000
committerNorbert Preining <preining@logic.at>2017-04-15 00:14:53 +0000
commit60b42ef1e1d7036f8dfe08a7e66f824c26a659fb (patch)
treec19161e6ee8ad923dd18853e2129ca31676a4e55
parent4299270b888777d238cab425a55014ae05b6f5d8 (diff)
support forced arguments in standard prompts, no bold
git-svn-id: svn://tug.org/texlive/trunk@43802 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl28
1 files changed, 23 insertions, 5 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 4318029d48a..dfb6811ebfa 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -6504,12 +6504,11 @@ sub check_on_writable {
# 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 @@ sub action_shell {
my $prompt = "";
my @options;
my @guarantee;
+ my @savedargs = @_;
while (defined(my $arg = shift @_)) {
if ($arg =~ m/^-prompt$/) {
$prompt .= shift @_;
@@ -6541,9 +6541,23 @@ sub action_shell {
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 @@ sub action_shell {
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 @@ sub action_shell {
$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);