diff options
author | Francois Pons <fpons@mandriva.com> | 2003-09-19 14:15:10 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2003-09-19 14:15:10 +0000 |
commit | b6a045527eb4293f1569b8d534180adf8ad688e8 (patch) | |
tree | 45d02224a4b9ddc88e3487a3df98f5a9a45787b6 /urpme | |
parent | 5c7264f47e156a5283ef2f542f51a465b1a18289 (diff) | |
download | urpmi-b6a045527eb4293f1569b8d534180adf8ad688e8.tar urpmi-b6a045527eb4293f1569b8d534180adf8ad688e8.tar.gz urpmi-b6a045527eb4293f1569b8d534180adf8ad688e8.tar.bz2 urpmi-b6a045527eb4293f1569b8d534180adf8ad688e8.tar.xz urpmi-b6a045527eb4293f1569b8d534180adf8ad688e8.zip |
on-going 4.4-38mdk
Diffstat (limited to 'urpme')
-rw-r--r-- | urpme | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -41,6 +41,7 @@ usage: ", $urpm::VERSION) . N(" --help - print this help message. ") . N(" --auto - automatically select a package in choices. ") . N(" --test - verify if the installation can be achieved correctly. +") . N(" --force - force invocation even if some packages do not exist. ") . N(" --parallel - distributed urpmi accross machines of alias. ") . N(" -v - verbose mode. ") . N(" -a - select all packages matching expression. @@ -107,8 +108,8 @@ if ($test && $auto) { $sum += $state->{rejected}{$_}{size}; } my $msg = N("To satisfy dependencies, the following packages will be removed (%d MB)", toMb($sum)); - print STDOUT "$msg:\n$list\n$askok" . N(" (Y/n) "); - <STDIN> =~ /[$noexpr]/ and exit 0; + print STDOUT "$msg:\n$list\n"; + message_input("$askok" . N(" (Y/n) "), $force && $yesexpr, boolean => 1) =~ /[$noexpr]/ and exit 0; } print STDOUT "\n".N("removing %s", join(' ', sort @toremove))."\n"; @@ -121,3 +122,30 @@ sub toMb { my $nb = $_[0] / 1024 / 1024; int $nb + 0.5; } + +sub message_input { + my ($msg, $default_input, %options) = @_; + my $input; + my $noexpr = N("Nn"); + my $yesexpr = N("Yy"); + + while (1) { + print STDOUT $msg; + if ($default_input) { + $bug and log_it($input); + return $default_input; + } + $input = <STDIN>; + defined $input or return undef; + $bug and log_it($input); + if ($options{boolean}) { + $input =~ /^[$noexpr$yesexpr]*$/ and last; + } elsif ($options{range}) { + 1 <= $input && $input <= $options{range} and last; + } else { + last; + } + print STDOUT N("Sorry, bad choice, try again\n")."\n"; + } + return $input; +} |