summaryrefslogtreecommitdiffstats
path: root/urpm/msg.pm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm/msg.pm')
-rw-r--r--urpm/msg.pm21
1 files changed, 20 insertions, 1 deletions
diff --git a/urpm/msg.pm b/urpm/msg.pm
index a79e59b8..ca81d9fe 100644
--- a/urpm/msg.pm
+++ b/urpm/msg.pm
@@ -1,4 +1,5 @@
package urpm::msg;
+# vim:et:ai:ts=4:sts=4:sw=4
use strict;
@@ -6,6 +7,7 @@ no warnings;
use Exporter;
use URPM;
use urpm::util 'append_to_file';
+use Term::ANSIColor;
my $encoding;
BEGIN {
@@ -14,7 +16,7 @@ BEGIN {
}
our @ISA = 'Exporter';
-our @EXPORT = qw(N N_ P translate bug_log message_input toMb formatXiB sys_log);
+our @EXPORT = qw(H N N_ P translate bug_log message_input toMb formatXiB sys_log);
#- I18N.
use Locale::gettext;
@@ -65,6 +67,23 @@ sub P {
sprintf(translate($s_singular, $s_plural, $nb), @para);
}
+sub H {
+ my ($label, $istring) = @_;
+ my $color = '';
+ my %colors = (
+ "Alert" => 'red',
+ "Error" => 'red',
+ "Warning" => 'bright_yellow',
+ "Arg" => 'cyan',
+ "Package" => 'bold white',
+ "Highlight" => 'bright_yellow',
+ "Progress" => 'blue',
+ "Success" => 'bright_green'
+ );
+ my $output = color($colors{$label}) . $istring . color('reset');
+ return $output;
+}
+
sub N {
my ($format, @params) = @_;
sprintf(translate($format), @params);