From 3da3d3f99d409828678f35f8301de69e5acd2c9d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 11 Jun 2010 20:21:03 -0400 Subject: [PATCH 1/2] Documentation - Added FAQ about deleting an annotation. --- doc/man/task-faq.5 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/man/task-faq.5 b/doc/man/task-faq.5 index 7ba541d8e..21890c9b3 100644 --- a/doc/man/task-faq.5 +++ b/doc/man/task-faq.5 @@ -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 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" task was written by P. Beckingham . .br From bb19361956ab5e72018153f0701f6c26e7552744 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 13 Jun 2010 12:45:41 -0400 Subject: [PATCH 2/2] Feature #298 - Configurable recurring task count - Added new recurrence.limit value (default 1) to control the number of future pending tasks generated from a recurring parent task. - Added unit tests. - Updated taskrc man page. --- ChangeLog | 2 ++ doc/man/taskrc.5 | 7 +++++ src/Config.cpp | 1 + src/command.cpp | 2 +- src/recur.cpp | 5 ++++ src/tests/recur.limit.t | 63 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 1 deletion(-) create mode 100755 src/tests/recur.limit.t diff --git a/ChangeLog b/ChangeLog index 7b26af066..d7b9a135e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ + Added feature #407, a new 'task show' command to display the current configuration settings or just the ones matching a search string. '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 helper command used by shell completion scripts. + Fixed bug #211 - it was unclear which commands modify a task description. diff --git a/doc/man/taskrc.5 b/doc/man/taskrc.5 index b2bd9f3d4..a8d0a7493 100644 --- a/doc/man/taskrc.5 +++ b/doc/man/taskrc.5 @@ -261,6 +261,13 @@ The character or string to show in the tag_indicator column. Defaults to +. .B recurrence.indicator=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 .B debug=off Task has a debug mode that causes diagnostic output to be displayed. Typically diff --git a/src/Config.cpp b/src/Config.cpp index 7eb3e075e..b698874d3 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -75,6 +75,7 @@ std::string Config::defaults = "active.indicator=* # What to show as an active task 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.limit=1 # Number of future recurring pending tasks\n" "\n" "# Dates\n" "dateformat=m/d/Y # Preferred input and display date format\n" diff --git a/src/command.cpp b/src/command.cpp index 27f028dce..172d05ed0 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -640,7 +640,7 @@ int handleShow (std::string &outs) "next project shadow.command shadow.file shadow.notify weekstart editor " "import.synonym.id import.synonym.uuid complete.all.projects " "complete.all.tags search.case.sensitive hooks active.indicator tag.indicator " - "recurrence.indicator " + "recurrence.indicator recurrence.limit " #ifdef FEATURE_SHELL "shell.prompt " #endif diff --git a/src/recur.cpp b/src/recur.cpp index 1b7c59d30..81e5bfd10 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -156,6 +156,8 @@ bool generateDueDates (Task& parent, std::vector & allDue) specificEnd = true; } + int recurrence_limit = context.config.getInteger ("recurrence.limit"); + int recurrence_counter = 0; Date now; for (Date i = due; ; i = getNextRecurrence (i, recur)) { @@ -175,6 +177,9 @@ bool generateDueDates (Task& parent, std::vector & allDue) } if (i > now) + ++recurrence_counter; + + if (recurrence_counter >= recurrence_limit) return true; } diff --git a/src/tests/recur.limit.t b/src/tests/recur.limit.t new file mode 100755 index 000000000..b9f716d12 --- /dev/null +++ b/src/tests/recur.limit.t @@ -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; +