[Bps-public-commit] r12125 - in Net-Hiveminder: lib/Net
sartak at bestpractical.com
sartak at bestpractical.com
Wed May 7 03:11:01 EDT 2008
Author: sartak
Date: Wed May 7 03:11:00 2008
New Revision: 12125
Modified:
Net-Hiveminder/ (props changed)
Net-Hiveminder/Changes
Net-Hiveminder/lib/Net/Hiveminder.pm
Log:
r55166 at onn: sartak | 2008-05-07 03:10:33 -0400
Add a "color" option to display_tasks; color the record locator by priority
Modified: Net-Hiveminder/Changes
==============================================================================
--- Net-Hiveminder/Changes (original)
+++ Net-Hiveminder/Changes Wed May 7 03:11:00 2008
@@ -1,5 +1,9 @@
Revision history for Net-Hiveminder
+0.06
+ Add a "color" option to display_tasks; color the record locator by
+ priority
+
0.05 Mon Mar 17 08 13:22:32
todo, create_task and braindump now use filters so you can have .hm
files in your directories to have filters applied
Modified: Net-Hiveminder/lib/Net/Hiveminder.pm
==============================================================================
--- Net-Hiveminder/lib/Net/Hiveminder.pm (original)
+++ Net-Hiveminder/lib/Net/Hiveminder.pm Wed May 7 03:11:00 2008
@@ -79,6 +79,10 @@
Make the record locator (C<#foo>) into an HTML link, pointing to the task on
C<site>.
+=item color
+
+Use ANSI escape-sequence colors.
+
=back
=cut
@@ -103,15 +107,25 @@
$display .= '* ';
}
+ my $loc_display = "#$locator";
+ if ($args{color}) {
+ my $color = $task->{priority} >= 5 ? "\e[31m" # red
+ : $task->{priority} == 4 ? "\e[33m" # yellow
+ : $task->{priority} == 2 ? "\e[36m" # cyan
+ : $task->{priority} <= 1 ? "\e[34m" # blue
+ : "";
+ $loc_display = "$color$loc_display\e[m" if $color;
+ }
+
if ($args{linkify_locator}) {
- $display .= sprintf '<a href="%s/task/%s">#%s</a>: %s',
+ $display .= sprintf '<a href="%s/task/%s">%s</a>: %s',
$self->site,
$locator,
- $locator,
+ $loc_display,
$task->{summary};
}
else {
- $display .= "#$locator: $task->{summary}";
+ $display .= "$loc_display: $task->{summary}";
}
# don't display start date if it's <= today
More information about the Bps-public-commit
mailing list