From 73d6e05c0e67890848c251773ee9a2cebbb97ce7 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 5 Feb 2010 18:22:36 -0500 Subject: [PATCH] Bug Fix - #369 task config color.alternate does not take multiple args - Fixed bug that meant these commands would not work: $ task config name 'one two three' $ task config name one two three (thanks to Richard Querin). --- ChangeLog | 2 ++ src/command.cpp | 10 +++++++++- src/tests/rc.t | 11 ++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 128aef743..53371d804 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,6 +75,8 @@ Florian). + Fixed bug #368 which caused recurring tasks 'until' dates to be rendered as epoch numbers instead of dates (thanks to Cory Donnelly). + + Fixed bug #369 which prevented the config command from setting quoted or + unquoted multi-word values (thanks to Richard Querin). ------ old releases ------------------------------ diff --git a/src/command.cpp b/src/command.cpp index 086d4e36c..54b1272f6 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -560,7 +560,15 @@ int handleConfig (std::string &outs) std::string value = ""; if (args.size () > 1) - value = args[1]; + { + for (unsigned int i = 1; i < args.size (); ++i) + { + if (i > 1) + value += " "; + + value += args[i]; + } + } if (name != "") { diff --git a/src/tests/rc.t b/src/tests/rc.t index 5470225c4..740e11a76 100755 --- a/src/tests/rc.t +++ b/src/tests/rc.t @@ -29,7 +29,7 @@ use strict; use warnings; use File::Path; -use Test::More tests => 13; +use Test::More tests => 15; # Create the rc file, using rc.name:value. unlink 'foo.rc'; @@ -74,6 +74,15 @@ qx{echo 'y'|../task rc:foo.rc config -- report.:b +c}; $output = qx{../task rc:foo.rc config}; like ($output, qr/^report\.:b\s+\+c/ms, 'the -- operator is working'); +# Make sure the value is accepted if it has multiple words. +qx{echo 'y'|../task rc:foo.rc config must_be_unique 'one two three'}; +$output = qx{../task rc:foo.rc config}; +like ($output, qr/^must_be_unique\s+one two three$/ms, 'config allows multi-word quoted values'); + +qx{echo 'y'|../task rc:foo.rc config must_be_unique one two three}; +$output = qx{../task rc:foo.rc config}; +like ($output, qr/^must_be_unique\s+one two three$/ms, 'config allows multi-word unquoted values'); + rmtree 'foo', 0, 0; ok (!-r 'foo', 'Removed foo');