From 485893159222ba6c5bfc0df52197c6cd8e7d840c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 25 Sep 2011 11:37:57 -0400 Subject: [PATCH] Bug #846, Feature #827 - Added feature #827, which allows augmentation of default.command with extra arguments, when default.command itself contains mulitple arguments (thanks to Aikido Guy). - Fixed bug #846, which prevented the default.command configuration from handling multiple arguments (thanks to Uli Martens). --- ChangeLog | 9 +++++++-- src/A3.cpp | 7 ++++++- test/default.t | 32 ++++++++++++++------------------ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb533fb32..278864e33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -95,8 +95,11 @@ controlled by '#define HAVE_EXECUTE 1' in cmake.h. This allows a build that does not have the potential security hole, in the event that taskwarrior is run at elevated privilege, or run in the context of a web server. - + Added feature #813, new "eoq" and "soq" dates for the end and start of quarter. - (thanks to Dave French and Paulo Almeida for the patch) + + Added feature #813, new "eoq" and "soq" dates for the end and start of + quarter. (thanks to Dave French and Paulo Almeida for the patch). + + Added feature #827, which allows augmentation of default.command with extra + arguments, when default.command itself contains mulitple arguments (thanks to + Aikido Guy). # Tracked Bugs, sorted by ID. + Fixed bug #403, which disambiguates certain commands involving numbers. @@ -190,6 +193,8 @@ + Fixed bug #839, which caused problems when recurrence frequencies of '1m' were used. This is an obsolete form, and should now be '1mo' (thanks to Gour D). + + Fixed bug #846, which prevented the default.command configuration from + handling multiple arguments (thanks to Uli Martens). # Untracked Bugs, biggest first. + Fixed bug that required the '%YAML' prologue in a YAML import. diff --git a/src/A3.cpp b/src/A3.cpp index 143a3c5f8..ef8c62dc6 100644 --- a/src/A3.cpp +++ b/src/A3.cpp @@ -154,7 +154,12 @@ void A3::capture_first (const std::string& arg) { // Break the new argument into parts that comprise a series. std::vector series; - series.push_back (Arg (arg)); + + std::vector separated; + splitq (separated, arg, ' '); + std::vector ::iterator sep; + for (sep = separated.begin (); sep != separated.end (); ++sep) + series.push_back (Arg (*sep)); // Locate an appropriate place to insert the series. This would be // immediately after the program and command arguments. diff --git a/test/default.t b/test/default.t index 0745142bd..0e84388ed 100755 --- a/test/default.t +++ b/test/default.t @@ -28,7 +28,7 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 21; # Create the rc file. if (open my $fh, '>', 'default.rc') @@ -77,24 +77,20 @@ like ($output, qr/\//, 'default due added'); $output = qx{../src/task rc:default.rc}; like ($output, qr/1 PROJECT L .+ priority specified/, 'default command worked'); +qx{../src/task rc:default.rc add project:HOME priority:M due:tomorrow all specified}; +qx{echo '-- y' | ../src/task rc:default.rc config default.command 'list priority:M'}; +$output = qx{../src/task rc:default.rc}; +like ($output, qr/ M /, 'priority:M included in default command'); +unlike ($output, qr/ L /, 'priority:L excluded from default command'); + # Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.data'); - -unlink 'undo.data'; -ok (!-r 'undo.data', 'Removed undo.data'); - -unlink 'backlog.data'; -ok (!-r 'backlog.data', 'Removed backlog.data'); - -unlink 'synch.key'; -ok (!-r 'synch.key', 'Removed synch.key'); - -unlink 'default.rc'; -ok (!-r 'default.rc', 'Removed default.rc'); +unlink qw(pending.data completed.data undo.data backlog.data synch.key default.rc); +ok (! -r 'pending.data' && + ! -r 'completed.data' && + ! -r 'undo.data' && + ! -r 'backlog.data' && + ! -r 'synch.key' && + ! -r 'default.rc', 'Cleanup'); exit 0;