From ccf672320a1217068b6edc8419971476bb14c494 Mon Sep 17 00:00:00 2001 From: Maat Date: Wed, 31 Mar 2021 21:25:21 +0200 Subject: More color output to urpmi --- urpm/msg.pm | 5 ++++- urpmi | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/urpm/msg.pm b/urpm/msg.pm index 50910b90..c1d7a09a 100644 --- a/urpm/msg.pm +++ b/urpm/msg.pm @@ -79,10 +79,13 @@ sub H { "Error" => 'red', "Warning" => 'bright_yellow', "Arg" => 'cyan', + "Question" => 'cyan', + "Action" => 'cyan', "Package" => 'bold white', "Highlight" => 'bright_yellow', "Progress" => 'blue', - "Success" => 'bright_green' + "Success" => 'bright_green', + "Test" => 'bright_green' ); my $output = color($colors{$label}) . $istring . color('reset'); return $output; diff --git a/urpmi b/urpmi index 2a93c366..83e8aa8d 100755 --- a/urpmi +++ b/urpmi @@ -559,7 +559,7 @@ have to be removed for others to be upgraded:\n%s\n", $list); my $msg = urpm::select::conflicting_packages_msg_(\@conflicting_pkgs_msgs); if ($test) { - $msg = "$msg\n" . N("(test only, removal will not be actually done)"); + $msg = "$msg\n" . H("Test",N("(test only, removal will not be actually done)")); } if ($urpm->{options}{auto}) { print H('Highlight',"$msg\n"); @@ -578,7 +578,7 @@ my @to_install = @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selecte if ($install_src) { if (@binary && $install_src && !$env) { my $list = join(' ', sort map { $_->name } @binary); - $urpm->{fatal}(1, N("You must first call urpmi with --buildrequires to install the following dependencies:\n%s\n", $list)); + $urpm->{fatal}(1, H("Alert",N("You must first call urpmi with --buildrequires to install the following dependencies:\n%s\n", $list))); } } else { @to_install = @binary; @@ -623,21 +623,21 @@ warn_msg("--force") if $urpm->{options}{force}; warn_msg("--keep") if $urpm->{options}{keep}; if (!$urpm->{options}{auto} && $ask_user && $urpm->{nb_install} || $env && !$options{debug__do_not_install}) { - my $msg = $urpm->{nb_install} == 1 ? N("To satisfy dependencies, the following package is going to be installed:") - : N("To satisfy dependencies, the following packages are going to be installed:"); + my $msg = $urpm->{nb_install} == 1 ? H("Highlight",N("To satisfy dependencies, the following package is going to be installed:")) + : H("Highlight",N("To satisfy dependencies, the following packages are going to be installed:")); if ($test) { - $msg = "$msg\n" . N("(test only, installation will not be actually done)"); + $msg = "$msg\n" . H("Test",N("(test only, installation will not be actually done)")); } my ($size, $filesize) = $urpm->selected_size_filesize($state); my @to_install_formatted = urpm::msg::format_line_selected_packages($urpm, $state, \@to_install); my $msg2 = $size >= 0 ? - N("%s of additional disk space will be used.", formatXiB($size)) : - N("%s of disk space will be freed.", formatXiB(-$size)); + H("Highlight",N("%s of additional disk space will be used.", formatXiB($size))) : + H("Highlight",N("%s of disk space will be freed.", formatXiB(-$size))); my $msg2_ = $filesize ? N("%s of packages will be retrieved.", formatXiB($filesize)) . "\n" : ''; - my $msg3 = P("Proceed with the installation of one package?", + my $msg3 = H("Question",P("Proceed with the installation of one package?", "Proceed with the installation of the %d packages?", - $urpm->{nb_install}, $urpm->{nb_install}); + $urpm->{nb_install}, $urpm->{nb_install})); my $p = join("\n", $msg, @to_install_formatted, $msg2, $msg2_ . $msg3); if ($env && !$options{debug__do_not_install}) { print "$p\n"; @@ -651,13 +651,13 @@ my $exit_code = urpm::main_loop::run($urpm, $state, int(@names || @src_names || @files || @src_files), \@ask_unselect, { (!$urpm->{options}{auto} || $allow_medium_change ? (copy_removable => sub { - my $msg = N("Please insert the medium named \"%s\"", $_[0]); + my $msg = H("Action",N("Please insert the medium named \"%s\"", $_[0])); if (eval { require Hal::Cdroms; 1 }) { print "$msg\n"; Hal::Cdroms->new->wait_for_insert; 1; } else { - my $msg2 = N("Press Enter when mounted..."); + my $msg2 = H("Action",N("Press Enter when mounted...")); defined message_input("$msg\n$msg2 "); } }) : ()), -- cgit v1.2.1