Package: watchupstream Version: 0.5.1 Severity: wishlist Tags: patch colored output would help the readability of the output. My color choices aren't very good, I'll admit, but here's my patches.
-- _________________________ Ryan Niebur [email protected]
--- watchupstream.1.old 2009-04-07 23:03:36.000000000 -0700 +++ watchupstream.1 2009-04-07 23:03:37.000000000 -0700 @@ -99,6 +99,9 @@ .B \-\-try=url Try to create a watch file automatically using the given url. This option implies the options --nocache and --export. +.TP +.B \-\-color +Print the output in color. .SH EXAMPLES .TP
--- watchupstream 2008-07-04 05:11:18.000000000 -0700
+++ watchupstream.new 2009-04-07 23:44:21.000000000 -0700
@@ -37,6 +37,7 @@
my $loadcpan = '';
my $loadsf = '';
my $debug = '';
+my $color = '';
GetOptions
(
"packre=s" => \$packre,
@@ -51,11 +52,14 @@
"loadcpan" => \$loadcpan,
"loadsf" => \$loadsf,
"debug" => \$debug,
+ "color" => \$color,
) or die;
$export = 1 if( $try );
$nocache = 1 if( $try );
$nocache = 1 if( $export );
+use Term::ANSIColor qw(:constants);
+
# create user configuration directory
my $usrcfgdir = glob( "~/.watchupstream" );
mkdir $usrcfgdir if( ! -d $usrcfgdir );
@@ -452,12 +456,25 @@
return $package;
}
+my %colorhash = ();
+$colorhash{"unknown"} = BOLD YELLOW;
+$colorhash{"OK"} = GREEN;
+$colorhash{"ahead"} = BOLD MAGENTA;
+$colorhash{"native"} = "";
+$colorhash{"outdated"} = BOLD RED;
+
# subroutine to show the result
sub show_result
{
my $package = shift;
+ my $coloring = '';
+ my $uncoloring = '';
+ if($color) {
+ $coloring = $colorhash{$resultuscan{$package}};
+ $uncoloring = RESET;
+ }
print "$resulttime{$package} $package"
- . " $resultlocal{$package} $resultnewest{$package}
$resultuscan{$package}\n";
+ . " $resultlocal{$package} $resultnewest{$package} " .
$coloring . "$resultuscan{$package}" . $uncoloring . "\n";
}
# subroutine to evaluate a watch file
signature.asc
Description: Digital signature

