File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,21 @@ use POSIX qw[ _exit ];
36
36
use IO::Handle qw[ flush ] ;
37
37
use mtr_results;
38
38
39
+ use Term::ANSIColor;
40
+
41
+ my %color_map = qw/ pass green
42
+ retry-pass green
43
+ fail red
44
+ retry-fail red
45
+ disabled bright_black
46
+ skipped yellow
47
+ reset reset/ ;
48
+ sub xterm_color {
49
+ if (-t STDOUT and defined $ENV {TERM } and $ENV {TERM } =~ / xterm/ ) {
50
+ syswrite STDOUT , color($color_map {$_ [0]});
51
+ }
52
+ }
53
+
39
54
my $tot_real_time = 0;
40
55
41
56
our $timestamp = 0;
@@ -494,7 +509,16 @@ sub mtr_print (@) {
494
509
sub mtr_report (@) {
495
510
if (defined $verbose )
496
511
{
497
- print _name(). join (" " , @_ ). " \n " ;
512
+ my @s = split /\[ (\S+) \]/, _name() . " @_ \n " ;
513
+ if (@s > 1) {
514
+ print $s [0];
515
+ xterm_color($s [1]);
516
+ print " [ $s [1] ]" ;
517
+ xterm_color(' reset' );
518
+ print $s [2];
519
+ } else {
520
+ print $s [0];
521
+ }
498
522
}
499
523
}
500
524
You can’t perform that action at this time.
0 commit comments