diff options
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 49 |
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) { |