summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2017-04-15 00:14:46 +0000
committerNorbert Preining <preining@logic.at>2017-04-15 00:14:46 +0000
commit4299270b888777d238cab425a55014ae05b6f5d8 (patch)
tree9685ff65a72d415a4f2936d8ea8352f8057a9b3a /Master/texmf-dist
parent974bf06b1ce6cad9ff152764f4d78b6f16c58cd1 (diff)
prompt rework, better set/get interaction
git-svn-id: svn://tug.org/texlive/trunk@43801 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl49
1 files changed, 42 insertions, 7 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 56133e0df85..4318029d48a 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -6504,20 +6504,47 @@ sub check_on_writable {
# tlmgr shell code
sub action_shell {
my $protocol = 1;
- our $prompt = "tlmgr> ";
eval {
- require MMMMIO::Prompter;
+ require IO::Prompter;
};
our $promptfunc;
if ($@) {
printf STDERR "Cannot find IO::Prompter module, reduced interactive functionality!\n";
$promptfunc = sub {
- our $prompt;
- print "$prompt";
+ my $default_prompt = "tlmgr>";
+ my $prompt = "";
+ my @options;
+ my @guarantee;
+ while (defined(my $arg = shift @_)) {
+ if ($arg =~ m/^-prompt$/) {
+ $prompt .= shift @_;
+ } elsif ($arg =~ m/^-style$/) {
+ # ignore style here
+ shift @_;
+ } elsif ($arg =~ m/^-menu$/) {
+ my $options = shift @_;
+ @options = @$options;
+ } elsif ($arg =~ m/^-guarantee$/) {
+ my $guarantee = shift @_;
+ @guarantee = @$guarantee;
+ } elsif ($arg =~ m/^-/) {
+ print "ERROR unsupported prompt command, please report: $arg!\n";
+ } else {
+ $prompt .= $arg;
+ }
+ }
+ $prompt = ($prompt ? $prompt : $default_prompt );
+ print "$prompt ";
+ if (@options) {
+ print "(", join(",", @options), ") ";
+ }
my $ans = <STDIN>;
chomp($ans);
+ if (@guarantee) {
+ # TODO TODO TODO
+ }
return($ans);
}
} else {
@@ -6533,7 +6560,7 @@ sub action_shell {
while (1) {
# print $prompt;
# my $ans = <STDIN>;
- my $ans = do_prompt(-prompt => $prompt, -style => 'bold');
+ my $ans = do_prompt('tlmgr>', -style => 'bold');
# chomp $ans;
my ($cmd, @args) = TeXLive::TLUtils::quotewords('\s+', 0, $ans);
next if (!$cmd);
@@ -6553,8 +6580,12 @@ sub action_shell {
if (!$key) {
$key = do_prompt('Choose...', -menu => \@valid_keys, '>');
}
+ if (!$key) {
+ print("ERROR missing argument for get\n");
+ next;
+ }
if ($cmd eq "get" && defined($val)) {
- print("ERROR no argument allowed for set\n");
+ print("ERROR no argument allowed for get\n");
next;
}
if ($cmd eq "set" && !defined($val)) {
@@ -6568,7 +6599,11 @@ sub action_shell {
if ($cmd eq "set") {
$location = scalar($val);
} else {
- print "repository = $location\n";
+ if (defined($location)) {
+ print "repository = $location\n";
+ } else {
+ print "repository = <UNDEFINED>\n";
+ }
}
print "OK\n";
} elsif ($key =~ m/^(debug-translation|machine-readable|no-execute-actions|require-verification|verify-downloads)$/i) {