mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Calendar details
- added 2 new configuration variables 'calendar.details' and 'calendar.details.report' that make it possible to display details of task with due date when doing 'task cal'
This commit is contained in:
parent
a75e7978ab
commit
6dd00f41e9
6 changed files with 140 additions and 17 deletions
13
ChangeLog
13
ChangeLog
|
@ -4,12 +4,13 @@
|
||||||
1.9.0 ()
|
1.9.0 ()
|
||||||
+ Added feature #292 that permits alternate line coloration in reports
|
+ Added feature #292 that permits alternate line coloration in reports
|
||||||
(thanks to Richard Querin).
|
(thanks to Richard Querin).
|
||||||
+ The 'delete' command is now aliased to 'rm' (thanks to Ivo Jimenez).
|
+ Added feature #307 that provides vim with syntax highlighting for .taskrc.
|
||||||
+ Added feature #336 which gives task a 'prepend' command for symmetry
|
+ Added feature #336 which gives task a 'prepend' command for symmetry
|
||||||
with the 'append' command.
|
with the 'append' command.
|
||||||
+ Added feature #341 that makes explicit references to the task and taskrc
|
+ Added feature #341 that makes explicit references to the task and taskrc
|
||||||
man pages, both in the auto-generated .taskrc file and the version command
|
man pages, both in the auto-generated .taskrc file and the version command
|
||||||
output (thanks to Cory Donnelly).
|
output (thanks to Cory Donnelly).
|
||||||
|
+ The 'delete' command is now aliased to 'rm' (thanks to Ivo Jimenez).
|
||||||
+ Added new attribute modifiers 'word' and 'noword' which find the existence
|
+ Added new attribute modifiers 'word' and 'noword' which find the existence
|
||||||
of whole words, or prove the non-existence of whole words. If a task has
|
of whole words, or prove the non-existence of whole words. If a task has
|
||||||
the description "Pay the bill", then "description.word:the" will match, but
|
the description "Pay the bill", then "description.word:the" will match, but
|
||||||
|
@ -26,23 +27,25 @@
|
||||||
custom reports.
|
custom reports.
|
||||||
+ The new 'priority_long' field can be shown in custom reports, and will
|
+ The new 'priority_long' field can be shown in custom reports, and will
|
||||||
display 'High' rather than the abbreviated 'H'.
|
display 'High' rather than the abbreviated 'H'.
|
||||||
+ Added feature #307 that provides vim with syntax highlighting for .taskrc.
|
|
||||||
+ Task now supports .taskrc command line overrides using rc.name:value and
|
+ Task now supports .taskrc command line overrides using rc.name:value and
|
||||||
the new rc.name=value to accommodate a frequent mistake.
|
the new rc.name=value to accommodate a frequent mistake.
|
||||||
+ The color rules for projects (color.project.foo) now matches on partial
|
+ The color rules for projects (color.project.foo) now matches on partial
|
||||||
project names, the same way as filters.
|
project names, the same way as filters.
|
||||||
+ The color command now takes a color as an argument, and displays that color
|
+ The color command now takes a color as an argument, and displays that color
|
||||||
with sample text.
|
with sample text.
|
||||||
+ Fixed bug that showed a calendar for the year 2037 when 'task calendar due'
|
+ Added 2 new configuration variables to display the details of tasks with due
|
||||||
was run, and there are no tasks with due dates.
|
dates when doing a 'task cal' for the corresponding months:
|
||||||
|
'calendar.details' and 'calendar.details.report'
|
||||||
+ Fixed bug #316 which caused the timesheet report to display an oddly sorted
|
+ Fixed bug #316 which caused the timesheet report to display an oddly sorted
|
||||||
list.
|
list.
|
||||||
+ Fixed bug #317 which colored tasks in the 'completed' report according to
|
+ Fixed bug #317 which colored tasks in the 'completed' report according to
|
||||||
due dates, which are no longer relevant to a completed task (thanks to
|
due dates, which are no longer relevant to a completed task (thanks to
|
||||||
Cory Donnelly).
|
Cory Donnelly).
|
||||||
+ Fixed bug that was causing the 'completed' report to sort incorrectly.
|
|
||||||
+ Fixed bug #347 which used only a lowercase "all" to confirm multiple changes
|
+ Fixed bug #347 which used only a lowercase "all" to confirm multiple changes
|
||||||
instead of an uppercase "All" like the "Yes" answer.
|
instead of an uppercase "All" like the "Yes" answer.
|
||||||
|
+ Fixed bug that was causing the 'completed' report to sort incorrectly.
|
||||||
|
+ Fixed bug that showed a calendar for the year 2037 when 'task calendar due'
|
||||||
|
was run, and there are no tasks with due dates.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,14 @@ The week number is dependent on the day a week starts.
|
||||||
This is the number of days into the future that define when a task is considered due,
|
This is the number of days into the future that define when a task is considered due,
|
||||||
and is colored accordingly. Defaults to 7.
|
and is colored accordingly. Defaults to 7.
|
||||||
|
|
||||||
|
.TP calendar.details=no
|
||||||
|
If set to yes running "task calendar" will display the details of tasks with due dates
|
||||||
|
that fall into the calendar period.
|
||||||
|
|
||||||
|
.TP calendar.details.report=list
|
||||||
|
The report to run when displaying the details of tasks with due date when running the
|
||||||
|
"task calendar" command.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B monthsperline=2
|
.B monthsperline=2
|
||||||
Determines how many months the "task calendar" command renders across the screen.
|
Determines how many months the "task calendar" command renders across the screen.
|
||||||
|
|
|
@ -152,6 +152,8 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
|
||||||
<< "weekstart=Sunday # Sunday or Monday only\n"
|
<< "weekstart=Sunday # Sunday or Monday only\n"
|
||||||
<< "displayweeknumber=yes # Show week numbers on calendar\n"
|
<< "displayweeknumber=yes # Show week numbers on calendar\n"
|
||||||
<< "due=7 # Task is considered due in 7 days\n"
|
<< "due=7 # Task is considered due in 7 days\n"
|
||||||
|
<< "#calendar.details=yes # Calendar shows information for tasks w/due dates\n"
|
||||||
|
<< "#calendar.details.report=list # Report to use when showing task information in cal\n"
|
||||||
<< "#monthsperline=2 # Number of calendar months on a line\n"
|
<< "#monthsperline=2 # Number of calendar months on a line\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "# Color controls.\n"
|
<< "# Color controls.\n"
|
||||||
|
|
|
@ -551,10 +551,10 @@ int handleConfig (std::string &outs)
|
||||||
// These are the regular configuration variables.
|
// These are the regular configuration variables.
|
||||||
// Note that there is a leading and trailing space, to make searching easier.
|
// Note that there is a leading and trailing space, to make searching easier.
|
||||||
std::string recognized =
|
std::string recognized =
|
||||||
" blanklines bulk color color.active color.due color.overdue color.pri.H "
|
" blanklines bulk calendar.details calendar.details.report color color.active "
|
||||||
"color.pri.L color.pri.M color.pri.none color.recurring color.tagged "
|
"color.due color.overdue color.pri.H color.pri.L color.pri.M color.pri.none "
|
||||||
"color.footnote color.header color.debug color.alternate confirmation "
|
"color.recurring color.tagged color.footnote color.header color.debug color.alternate "
|
||||||
"curses data.location dateformat debug default.command default.priority "
|
"confirmation curses data.location dateformat debug default.command default.priority "
|
||||||
"default.project defaultwidth due locale displayweeknumber echo.command "
|
"default.project defaultwidth due locale displayweeknumber echo.command "
|
||||||
"locking monthsperline nag next project shadow.command shadow.file "
|
"locking monthsperline nag next project shadow.command shadow.file "
|
||||||
"shadow.notify weekstart editor import.synonym.id import.synonym.uuid "
|
"shadow.notify weekstart editor import.synonym.id import.synonym.uuid "
|
||||||
|
|
|
@ -1571,9 +1571,11 @@ int handleReportCalendar (std::string &outs)
|
||||||
yTo++;
|
yTo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int details_yFrom = yFrom;
|
||||||
|
int details_mFrom = mFrom;
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
std::string output;
|
|
||||||
|
|
||||||
while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo))
|
while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo))
|
||||||
{
|
{
|
||||||
|
@ -1645,6 +1647,44 @@ int handleReportCalendar (std::string &outs)
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
|
if (context.config.get (std::string ("calendar.details"), false))
|
||||||
|
{
|
||||||
|
--details_mFrom;
|
||||||
|
if (details_mFrom == 0)
|
||||||
|
{
|
||||||
|
details_mFrom = 12;
|
||||||
|
--details_yFrom;
|
||||||
|
}
|
||||||
|
int details_dFrom = Date::daysInMonth (details_mFrom, details_yFrom);
|
||||||
|
|
||||||
|
++mTo;
|
||||||
|
if (mTo == 13)
|
||||||
|
{
|
||||||
|
mTo = 1;
|
||||||
|
++yTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
Date date_after (details_mFrom, details_dFrom, details_yFrom);
|
||||||
|
std::string after = date_after.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||||
|
|
||||||
|
Date date_before (mTo, 1, yTo);
|
||||||
|
std::string before = date_before.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||||
|
|
||||||
|
std::string report = context.config.get ("calendar.details.report", "list");
|
||||||
|
std::string report_filter = context.config.get ("report." + report + ".filter");
|
||||||
|
|
||||||
|
report_filter += " due.after:" + after + " due.before:" + before;
|
||||||
|
context.config.set ("report." + report + ".filter", report_filter);
|
||||||
|
|
||||||
|
context.args.clear ();
|
||||||
|
context.filter.clear ();
|
||||||
|
context.sequence.clear ();
|
||||||
|
|
||||||
|
std::string output;
|
||||||
|
handleCustomReport (report, output);
|
||||||
|
out << output;
|
||||||
|
}
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,15 @@ if (open my $fh, '>', 'cal.rc')
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'cal.rc', 'Created cal.rc');
|
ok (-r 'cal.rc', 'Created cal.rc');
|
||||||
}
|
}
|
||||||
|
|
||||||
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
||||||
my ($day, $nmon, $nyear) = (localtime)[3,4,5];
|
my ($nday, $nmon, $nyear) = (localtime)[3,4,5];
|
||||||
my $nextmonth = $months[($nmon+1) % 12];
|
my $day = $nday;
|
||||||
my $month = $months[($nmon) % 12];
|
|
||||||
my $prevmonth = $months[($nmon-1) % 12];
|
my $prevmonth = $months[($nmon-1) % 12];
|
||||||
my $nextyear = $nyear + 1901;
|
my $month = $months[($nmon) % 12];
|
||||||
|
my $nextmonth = $months[($nmon+1) % 12];
|
||||||
my $year = $nyear + 1900;
|
my $year = $nyear + 1900;
|
||||||
|
my $nextyear = $nyear + 1901;
|
||||||
|
|
||||||
if ( $day <= 9)
|
if ( $day <= 9)
|
||||||
{
|
{
|
||||||
|
@ -123,11 +125,79 @@ unlike ($output, qr/May 2010/, 'May 2010 is not displayed');
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink 'pending.data';
|
||||||
ok (!-r 'pending.data', 'Removed pending.data');
|
ok (!-r 'pending.data', 'Removed pending.data');
|
||||||
|
|
||||||
unlink 'undo.data';
|
unlink 'undo.data';
|
||||||
ok (!-r 'undo.data', 'Removed undo.data');
|
ok (!-r 'undo.data', 'Removed undo.data');
|
||||||
|
|
||||||
unlink 'cal.rc';
|
unlink 'cal.rc';
|
||||||
ok (!-r 'cal.rc', 'Removed cal.rc');
|
ok (!-r 'cal.rc', 'Removed cal.rc');
|
||||||
|
|
||||||
|
# Create the rc file.
|
||||||
|
if (open my $fh, '>', 'details.rc')
|
||||||
|
{
|
||||||
|
print $fh "data.location=.\n",
|
||||||
|
"dateformat=YMD\n",
|
||||||
|
"calendar.details=yes\n",
|
||||||
|
"calendar.details.report=list\n",
|
||||||
|
"color=on\n",
|
||||||
|
"confirmation=no\n";
|
||||||
|
close $fh;
|
||||||
|
ok (-r 'details.rc', 'Created details.rc');
|
||||||
|
}
|
||||||
|
|
||||||
|
# task calendar details
|
||||||
|
qx{../task rc:details.rc add due:20150105 one};
|
||||||
|
qx{../task rc:details.rc add due:20150110 two};
|
||||||
|
qx{../task rc:details.rc add due:20150210 three};
|
||||||
|
qx{../task rc:details.rc add due:20150410 four};
|
||||||
|
qx{../task rc:details.rc add due:20151225 five};
|
||||||
|
qx{../task rc:details.rc add due:20141231 six};
|
||||||
|
qx{../task rc:details.rc add due:20160101 seven};
|
||||||
|
qx{../task rc:details.rc add due:20081231 eight};
|
||||||
|
|
||||||
|
$output = qx{../task rc:details.rc cal rc.monthsperline:3 1 2015};
|
||||||
|
like ($output, qr/January 2015/, 'January 2015 is displayed');
|
||||||
|
like ($output, qr/20150105/, 'Due date 20150105 is displayed');
|
||||||
|
like ($output, qr/20150110/, 'Due date 20150110 is displayed');
|
||||||
|
like ($output, qr/20150210/, 'Due date 20150210 is displayed');
|
||||||
|
unlike ($output, qr/20141231/, 'Due date 20141231 is not displayed');
|
||||||
|
unlike ($output, qr/20150410/, 'Due date 20150410 is not displayed');
|
||||||
|
like ($output, qr/3 tasks/, '3 due tasks are displayed');
|
||||||
|
|
||||||
|
$output = qx{../task rc:details.rc cal due};
|
||||||
|
like ($output, qr/December 2008/, 'December 2008 is displayed');
|
||||||
|
like ($output, qr/20081231/, 'Due date 20081231 is displayed');
|
||||||
|
like ($output, qr/1 task/, '1 due task is displayed');
|
||||||
|
|
||||||
|
$output = qx{../task rc:details.rc cal 2015};
|
||||||
|
like ($output, qr/January 2015/, 'January 2015 is displayed');
|
||||||
|
like ($output, qr/December 2015/, 'December 2015 is displayed');
|
||||||
|
unlike ($output, qr/20141231/, 'Due date 20141231 is not displayed');
|
||||||
|
unlike ($output, qr/20160101/, 'Due date 20160101 is not displayed');
|
||||||
|
like ($output, qr/5 tasks/, '5 due tasks are displayed');
|
||||||
|
|
||||||
|
$day = $nday;
|
||||||
|
if ( $day <= 9)
|
||||||
|
{
|
||||||
|
$day = "0".$day;
|
||||||
|
}
|
||||||
|
my $mon = $nmon + 1;
|
||||||
|
if ( $mon <= 9)
|
||||||
|
{
|
||||||
|
$mon = "0".$mon;
|
||||||
|
}
|
||||||
|
my $duedate = $year.$mon.$day;
|
||||||
|
|
||||||
|
qx{../task rc:details.rc add due:$duedate rc.monthsperline:1 nine};
|
||||||
|
$output = qx{../task rc:details.rc cal};
|
||||||
|
like ($output, qr/$month\w+?\s+?$year/, 'Current month and year are displayed');
|
||||||
|
like ($output, qr/$duedate/, 'Due date on current day is displayed');
|
||||||
|
like ($output, qr/1 task/, '1 due task is displayed');
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
unlink 'pending.data';
|
||||||
|
ok (!-r 'pending.data', 'Removed pending.data');
|
||||||
|
unlink 'undo.data';
|
||||||
|
ok (!-r 'undo.data', 'Removed undo.data');
|
||||||
|
unlink 'details.rc';
|
||||||
|
ok (!-r 'details.rc', 'Removed details.rc');
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue