summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xurpmi36
1 files changed, 21 insertions, 15 deletions
diff --git a/urpmi b/urpmi
index 7d282d9e..de139894 100755
--- a/urpmi
+++ b/urpmi
@@ -27,6 +27,7 @@ use urpm::media;
use urpm::select;
use urpm::util qw(cat_ difference2 find member partition untaint);
use urpm::main_loop;
+use Term::ANSIColor;
#- default options.
our $update = 0;
@@ -63,8 +64,10 @@ $ENV{HOME} ||= "/root";
$ENV{USER} ||= "root";
sub usage () {
- print urpm::args::copyright('urpmi', [ '1999-2010', 'Mandriva' ], [ '2011-2020', 'Mageia' ])
- . N(" --help - print this help message.
+ print color('bright_yellow');
+ print urpm::args::copyright('urpmi', [ '1999-2010', 'Mandriva' ], [ '2011-2017', 'Mageia' ]);
+ print color('bold cyan');
+ print N(" --help - print this help message.
") . N(" --media - use only the given media, separated by comma.
") . N(" --excludemedia - do not use the given media, separated by comma.
") . N(" --update - use only update media.
@@ -149,8 +152,11 @@ sub usage () {
") . N(" --quiet, -q - quiet mode.
") . N(" --verbose, -v - verbose mode.
") . N(" --debug - very verbose mode.
-") . "\n" . N(" names or rpm files given on command line will be installed.
+") . "\n";
+ print color('bright_yellow');
+ print N(" names or rpm files given on command line will be installed.
");
+ print color('reset');
exit(1);
}
@@ -177,16 +183,16 @@ if (member('--restricted', @ARGV)) {
my $urpm = urpm->new_parse_cmdline or exit(1);
if (@ARGV && $auto_select) {
- print STDERR N("Error: can't use --auto-select along with package list.\n");
+ print STDERR color('red') . N("Error: can't use --auto-select along with package list.\n") . color('reset');
exit 1;
}
# Verify that arguments were given
unless (@ARGV || $auto_select || $clean) {
if ($options{bug}) {
- print STDERR N("Error: To generate a bug report, specify the usual command-line arguments
-along with --bug.\n");
- exit 1;
+ print STDERR color('red') . N("Error: To generate a bug report, specify the usual command-line arguments
+along with --bug.\n") . color('reset');;
+ exit 1;
}
usage();
}
@@ -390,8 +396,8 @@ if (@names) {
) || $force or exit 1;
if (%requested) {
- $urpm->{log}("found package(s): " . join(" ", sort map { scalar $urpm->{depslist}[$_]->fullname }
- map { split /\|/ } keys %requested));
+ $urpm->{log}("found package(s): " . join(" ", map { scalar $urpm->{depslist}[$_]->fullname }
+ map { split /\|/ } keys %requested));
}
}
if (@src_names) {
@@ -437,10 +443,10 @@ sub ask_choice {
my $n = 1; #- default value.
if (@l > 1 && !$urpm->{options}{auto}) {
- print N("In order to satisfy the '%s' dependency, one of the following packages is needed:", $virtual_pkg_name), "\n";
- my $i = 0;
- foreach (@l) { print " " . ++$i . "- $_\n" }
- $n = message_input(N("What is your choice? (1-%d) ", $i), default => $prefer, range_min => 0, range => $i);
+ print color('bright_yellow') . N("In order to satisfy the '%s' dependency, one of the following packages is needed:", $virtual_pkg_name) . color('reset'), "\n";
+ my $i = 0;
+ foreach (@l) { print " " . ++$i . "- $_\n" }
+ $n = message_input(N("What is your choice? (1-%d) ", $i), default => $prefer, range_min => 0, range => $i);
defined($n) && $n ne "0" or exit 1; # abort.
if ($n =~ /\D/) {
my @nn = map { $choices[$_ - 1] } grep { !/\D/ } split /[, \t]+/, $n;
@@ -596,7 +602,7 @@ $urpm->{nb_install} = @to_install;
sub warn_msg {
my ($msg) = @_;
- $urpm->{print}(N("WARNING: %s option is in use. Some strange problems may happen", $msg));
+ $urpm->{print}(color('red') . N("WARNING: %s option is in use. Some strange problems may happen", $msg) . color('reset'));
}
warn_msg("--allow-force") if $urpm->{options}{'allow-force'};
@@ -691,7 +697,7 @@ $exit_code ||= $urpm::postponed_code;
#- restart urpmi if needed, keep command line for that.
if ($restart_itself && !$exit_code) {
- print N("restarting urpmi"), "\n";
+ print color('bright_yellow') . N("restarting urpmi"), "\n" . color('reset');
#- it seems to work correctly with exec instead of system, provided
#- STDOUT or STDERR are not closed before (else no output at all).
#- added --previous-priority-upgrade to allow checking if yet if