mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Feature - #283 verbosity of annotations
- the configuration variable annotation.details now controls the verbosity of the output of annotations.
This commit is contained in:
parent
b001c2f40b
commit
3aae7b180b
6 changed files with 97 additions and 21 deletions
|
@ -2,11 +2,13 @@
|
|||
------ current release ---------------------------
|
||||
|
||||
1.9.0 ()
|
||||
+ Added feature #292 that permits alternate line coloration in reports
|
||||
(thanks to Richard Querin).
|
||||
+ Added feature #283 that makes it possible to control the verbosity
|
||||
of the output of annotations.
|
||||
+ Added feature #254 (#295) which gives task a second date format to be
|
||||
used in the reports with more conversion sequences like weekday name
|
||||
or weeknumber. The date format is set with variable "reportdateformat".
|
||||
+ Added feature #292 that permits alternate line coloration in reports
|
||||
(thanks to Richard Querin).
|
||||
+ Added feature #307 that provides vim with syntax highlighting for .taskrc.
|
||||
+ Added feature #336 which gives task a 'prepend' command for symmetry
|
||||
with the 'append' command.
|
||||
|
|
|
@ -115,6 +115,10 @@ May be "yes" or "no", and determines whether task will ask for confirmation befo
|
|||
.B echo.command=yes
|
||||
May be "yes" or "no", and causes task to display the ID and description of any task when you run the start, stop, do, undo or delete commands. The default value is "yes".
|
||||
|
||||
.TP
|
||||
.B annotation.details=2
|
||||
Controls the output of annotations in reports. Defaults to 2 - all annotations are displayed. Set to 1 only the last (youngest) annotation is displayed and if there are more than one present for a task a "+" sign is added to the description. Set to 0 the output of annotations is disabled and a "+" sign will be added if there are any annotations present.
|
||||
|
||||
.TP
|
||||
.B next=2
|
||||
Is a number, defaulting to 2, which is the number of tasks for each project that are shown in the
|
||||
|
|
|
@ -144,6 +144,7 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
|
|||
<< "# Miscellaneous\n"
|
||||
<< "confirmation=yes # Confirmation on delete, big changes\n"
|
||||
<< "echo.command=yes # Details on command just run\n"
|
||||
<< "annotation.details=2 # Level of verbosity for annotations in reports\n"
|
||||
<< "next=2 # How many tasks per project in next report\n"
|
||||
<< "bulk=2 # > 2 tasks considered 'a lot', for confirmation\n"
|
||||
<< "nag=You have higher priority tasks. # Nag message to keep you honest\n"
|
||||
|
|
|
@ -551,8 +551,8 @@ int handleConfig (std::string &outs)
|
|||
// These are the regular configuration variables.
|
||||
// Note that there is a leading and trailing space, to make searching easier.
|
||||
std::string recognized =
|
||||
" blanklines bulk calendar.details calendar.details.report color color.active "
|
||||
"color.due color.overdue color.pri.H color.pri.L color.pri.M color.pri.none "
|
||||
" annotation.details blanklines bulk calendar.details calendar.details.report color "
|
||||
"color.active color.due color.overdue color.pri.H color.pri.L color.pri.M color.pri.none "
|
||||
"color.recurring color.tagged color.footnote color.header color.debug color.alternate "
|
||||
"color.calendar.today color.calendar.due color.calendar.overdue color.calendar.weekend "
|
||||
"confirmation curses data.location dateformat reportdateformat debug default.command "
|
||||
|
|
|
@ -2113,12 +2113,32 @@ std::string getFullDescription (Task& task)
|
|||
|
||||
std::vector <Att> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
foreach (anno, annotations)
|
||||
{
|
||||
Date dt (atoi (anno->name ().substr (11).c_str ()));
|
||||
std::string when = dt.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||
desc += "\n" + when + " " + anno->value ();
|
||||
}
|
||||
|
||||
if (annotations.size () != 0)
|
||||
switch (context.config.get("annotation.details",2))
|
||||
{
|
||||
case 0:
|
||||
desc = "+" + desc;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if (annotations.size () > 1)
|
||||
desc = "+" + desc;
|
||||
Att anno (annotations.back());
|
||||
Date dt (atoi (anno.name ().substr (11).c_str ()));
|
||||
std::string when = dt.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||
desc += "\n" + when + " " + anno.value ();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
foreach (anno, annotations)
|
||||
{
|
||||
Date dt (atoi (anno->name ().substr (11).c_str ()));
|
||||
std::string when = dt.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||
desc += "\n" + when + " " + anno->value ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
use Test::More tests => 37;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'annotate.rc')
|
||||
|
@ -43,27 +43,76 @@ if (open my $fh, '>', 'annotate.rc')
|
|||
ok (-r 'annotate.rc', 'Created annotate.rc');
|
||||
}
|
||||
|
||||
# Add two tasks, annotate one twice.
|
||||
# Add four tasks, annotate one three times, one twice, one just once and one none.
|
||||
qx{../task rc:annotate.rc add one};
|
||||
qx{../task rc:annotate.rc add two};
|
||||
qx{../task rc:annotate.rc annotate 1 foo};
|
||||
sleep 2;
|
||||
qx{../task rc:annotate.rc annotate 1 bar};
|
||||
qx{../task rc:annotate.rc add three};
|
||||
qx{../task rc:annotate.rc add four};
|
||||
qx{../task rc:annotate.rc annotate 1 foo1};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 1 foo2};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 1 foo3};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 2 bar1};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 2 bar2};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 3 baz1};
|
||||
|
||||
my $output = qx{../task rc:annotate.rc rrr};
|
||||
|
||||
# ID Description
|
||||
# -- -------------------------------
|
||||
# 1 one
|
||||
# 3/24/2009 foo
|
||||
# 3/24/2009 bar
|
||||
# 3/24/2009 foo1
|
||||
# 3/24/2009 foo2
|
||||
# 3/24/2009 foo3
|
||||
# 2 two
|
||||
# 3/24/2009 bar1
|
||||
# 3/24/2009 bar2
|
||||
# 3 three
|
||||
# 3/24/2009 baz1
|
||||
# 4 four
|
||||
#
|
||||
# 2 tasks
|
||||
# 4 tasks
|
||||
like ($output, qr/1 one/, 'task 1');
|
||||
like ($output, qr/2 two/, 'task 2');
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo/ms, 'first annotation');
|
||||
like ($output, qr/foo.+\d{1,2}\/\d{1,2}\/\d{4} bar/ms, 'second annotation');
|
||||
like ($output, qr/2 tasks/, 'count');
|
||||
like ($output, qr/3 three/, 'task 3');
|
||||
like ($output, qr/4 four/, 'task 4');
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo1/ms, 'first annotation task 1');
|
||||
like ($output, qr/foo1.+\d{1,2}\/\d{1,2}\/\d{4} foo2/ms, 'second annotation task 1');
|
||||
like ($output, qr/foo2.+\d{1,2}\/\d{1,2}\/\d{4} foo3/ms, 'third annotation task 1');
|
||||
like ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar1/ms, 'first annotation task 2');
|
||||
like ($output, qr/bar1.+\d{1,2}\/\d{1,2}\/\d{4} bar2/ms, 'second annotation task 2');
|
||||
like ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4} baz1/ms,'first annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
$output = qx{../task rc:annotate.rc rc.annotation.details:1 rrr};
|
||||
like ($output, qr/1 \+one/, 'task 1');
|
||||
like ($output, qr/2 \+two/, 'task 2');
|
||||
like ($output, qr/3 three/, 'task 3');
|
||||
like ($output, qr/4 four/, 'task 4');
|
||||
unlike ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo1/ms, 'first annotation task 1');
|
||||
unlike ($output, qr/foo1.+\d{1,2}\/\d{1,2}\/\d{4} foo2/ms, 'second annotation task 1');
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo3/ms, 'third annotation task 1');
|
||||
unlike ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar1/ms, 'first annotation task 2');
|
||||
like ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar2/ms, 'second annotation task 2');
|
||||
like ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4} baz1/ms, 'third annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
$output = qx{../task rc:annotate.rc rc.annotation.details:0 rrr};
|
||||
like ($output, qr/1 \+one/, 'task 1');
|
||||
like ($output, qr/2 \+two/, 'task 2');
|
||||
like ($output, qr/3 \+three/, 'task 3');
|
||||
like ($output, qr/4 four/, 'task 4');
|
||||
unlike ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo1/ms, 'first annotation task 1');
|
||||
unlike ($output, qr/foo1.+\d{1,2}\/\d{1,2}\/\d{4} foo2/ms, 'second annotation task 1');
|
||||
unlike ($output, qr/foo2.+\d{1,2}\/\d{1,2}\/\d{4} foo3/ms, 'third annotation task 1');
|
||||
unlike ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar1/ms, 'first annotation task 2');
|
||||
unlike ($output, qr/bar1.+\d{1,2}\/\d{1,2}\/\d{4} bar2/ms, 'second annotation task 2');
|
||||
unlike ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4} baz1/ms, 'third annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue