Merge branch '1.9.2' of tasktools.org:task into 1.9.2

This commit is contained in:
Paul Beckingham 2010-06-15 08:31:08 -04:00
commit 5e55166617
7 changed files with 90 additions and 1 deletions

View file

@ -14,6 +14,8 @@
+ Added feature #407, a new 'task show' command to display the current + Added feature #407, a new 'task show' command to display the current
configuration settings or just the ones matching a search string. configuration settings or just the ones matching a search string.
'task config' is now only used to set new configuration values. 'task config' is now only used to set new configuration values.
+ Added feature #298, supporting a configurable number of future recurring
tasks that are generated.
+ Fixed bug #406 so that task now includes command aliases in the _commands + Fixed bug #406 so that task now includes command aliases in the _commands
helper command used by shell completion scripts. helper command used by shell completion scripts.
+ Fixed bug #211 - it was unclear which commands modify a task description. + Fixed bug #211 - it was unclear which commands modify a task description.

View file

@ -161,6 +161,17 @@ Some of you may be familiar with DeMorgan's laws of formal logic that relate
the AND and OR operators in terms of each other via negation, which can be used the AND and OR operators in terms of each other via negation, which can be used
to construct task filters. to construct task filters.
.TP
.B Q: How do I delete an annotation?
Task currently lacks a good command for deleting annotations. In the meantime,
use the 'edit' command:
$ task 123 edit
This will invoke your text editor, and you will be able to directly edit the
task details. Delete the line that contains the annotation you wish to remove,
then save and quit the editor.
.SH "CREDITS & COPYRIGHTS" .SH "CREDITS & COPYRIGHTS"
task was written by P. Beckingham <paul@beckingham.net>. task was written by P. Beckingham <paul@beckingham.net>.
.br .br

View file

@ -261,6 +261,13 @@ The character or string to show in the tag_indicator column. Defaults to +.
.B recurrence.indicator=R .B recurrence.indicator=R
The character or string to show in the recurrence_indicator column. Defaults to R. The character or string to show in the recurrence_indicator column. Defaults to R.
.TP
.B recurrence.limit=1
The number of future recurring tasks to show. Defaults to 1. For example, if a
weekly recurring task is added with a due date of tomorrow, and recurrence.limit
is set to 2, then a report will list 2 pending recurring tasks, one for tomorrow,
and one for a week from tomorrow.
.TP .TP
.B debug=off .B debug=off
Task has a debug mode that causes diagnostic output to be displayed. Typically Task has a debug mode that causes diagnostic output to be displayed. Typically

View file

@ -75,6 +75,7 @@ std::string Config::defaults =
"active.indicator=* # What to show as an active task indicator\n" "active.indicator=* # What to show as an active task indicator\n"
"tag.indicator=+ # What to show as a tag indicator\n" "tag.indicator=+ # What to show as a tag indicator\n"
"recurrence.indicator=R # What to show as a task recurrence indicator\n" "recurrence.indicator=R # What to show as a task recurrence indicator\n"
"recurrence.limit=1 # Number of future recurring pending tasks\n"
"\n" "\n"
"# Dates\n" "# Dates\n"
"dateformat=m/d/Y # Preferred input and display date format\n" "dateformat=m/d/Y # Preferred input and display date format\n"

View file

@ -640,7 +640,7 @@ int handleShow (std::string &outs)
"next project shadow.command shadow.file shadow.notify weekstart editor " "next project shadow.command shadow.file shadow.notify weekstart editor "
"import.synonym.id import.synonym.uuid complete.all.projects " "import.synonym.id import.synonym.uuid complete.all.projects "
"complete.all.tags search.case.sensitive hooks active.indicator tag.indicator " "complete.all.tags search.case.sensitive hooks active.indicator tag.indicator "
"recurrence.indicator " "recurrence.indicator recurrence.limit "
#ifdef FEATURE_SHELL #ifdef FEATURE_SHELL
"shell.prompt " "shell.prompt "
#endif #endif

View file

@ -156,6 +156,8 @@ bool generateDueDates (Task& parent, std::vector <Date>& allDue)
specificEnd = true; specificEnd = true;
} }
int recurrence_limit = context.config.getInteger ("recurrence.limit");
int recurrence_counter = 0;
Date now; Date now;
for (Date i = due; ; i = getNextRecurrence (i, recur)) for (Date i = due; ; i = getNextRecurrence (i, recur))
{ {
@ -175,6 +177,9 @@ bool generateDueDates (Task& parent, std::vector <Date>& allDue)
} }
if (i > now) if (i > now)
++recurrence_counter;
if (recurrence_counter >= recurrence_limit)
return true; return true;
} }

63
src/tests/recur.limit.t Executable file
View file

@ -0,0 +1,63 @@
#! /usr/bin/perl
################################################################################
## task - a command line task list manager.
##
## Copyright 2006 - 2010, Paul Beckingham.
## All rights reserved.
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 2 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, write to the
##
## Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor,
## Boston, MA
## 02110-1301
## USA
##
################################################################################
use strict;
use warnings;
use Test::More tests => 6;
# Create the rc file.
if (open my $fh, '>', 'recur.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'recur.rc', 'Created recur.rc');
}
# Add a recurring task, then see how many future pending tasks are
# generated by default, and by overriding rc.recurrence.limit.
qx{../task rc:recur.rc add ONE due:tomorrow recur:weekly};
my $output = qx{../task rc:recur.rc long};
my @tasks = $output =~ /(ONE)/g;
is (scalar @tasks, 1, 'recurrence.limit default to 1');
$output = qx{../task rc:recur.rc rc.recurrence.limit:4 long};
@tasks = $output =~ /(ONE)/g;
is (scalar @tasks, 4, 'recurrence.limit override to 4');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'recur.rc';
ok (!-r 'recur.rc', 'Removed recur.rc');
exit 0;