use DBI;
use Getopt::Long;
use Term::ReadLine;
+use Term::ANSIColor;
my $table = "stempel";
my $engine = "dbi:Pg:dbname=infocon";
my $sth = $dbh->prepare ($query);
+ my $customer = '';
+ my @colors = qw/blue green yellow red cyan magenta/;
+ my $color = $#colors;
if ($sth && $sth->execute > 0) {
while ((my $row = $sth->fetchrow_hashref)) {
if (defined $row->{time}) {
+ if ($customer ne $row->{customer}) {
+ $customer = $row->{customer};
+ if ($color == $#colors) {
+ $color = 0;
+ } else {
+ $color++;
+ }
+ }
my $day = (split(/ /, $row->{start}))[0];
my $time = min2hour $row->{time};
- printf "%-15s %s %s %s\n", $row->{customer}, $day, $time, $row->{task};
+ print color($colors[$color]);
+ printf "%-15s %s %s %s", $row->{customer}, $day, $time, $row->{task};
+ print color('reset'), "\n";
}
}
}