diff --git a/NEWS b/NEWS index bc1ff006f..b11b463d8 100644 --- a/NEWS +++ b/NEWS @@ -70,6 +70,7 @@ Newly deprecated features in taskwarrior 2.0.0 - The 'next' configuration variable has been removed. - Use of 'fg:' and 'bg:' attributes are deprecated. + - Use of 'echo.command' configuration variable. --- diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index 01004557b..4b67f5d03 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -233,7 +233,7 @@ for safety. .B echo.command=yes May be "yes" or "no", and causes the display of the ID and description of any task when you run the start, stop, do, undo or delete commands. The default -value is "yes". +value is "yes". Deprecated - use verbosity token 'affected'. .TP .B annotations=full diff --git a/src/Config.cpp b/src/Config.cpp index fbb4955df..153f2fc12 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -81,9 +81,9 @@ std::string Config::_defaults = "verbose=yes # Provide maximal feedback\n" "#verbose=no # Provide minimal feedback\n" "#verbose=list # Comma-separated list. May contain any subset of:\n" - "#verbose=blank,header,footnote,label,new-id\n" + "#verbose=blank,header,footnote,label,new-id,affected\n" "confirmation=yes # Confirmation on delete, big changes\n" - "echo.command=yes # Details on command just run\n" + "echo.command=yes # Details on command just run. Deprecated\n" "annotations=full # Level of verbosity for annotations: full, sparse or none\n" "indent.annotation=2 # Indent spaces for annotations\n" "indent.report=0 # Indent spaces for whole report\n" diff --git a/src/Context.cpp b/src/Context.cpp index a5e8f7ed7..7e18a9f01 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -391,10 +391,8 @@ bool Context::verbose (const std::string& token) split (verbosity, config.get ("verbose"), ','); } - if (verbosity_legacy) - return true; - - if (std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ()) + if (verbosity_legacy || + std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ()) return true; return false; diff --git a/src/commands/CmdAnnotate.cpp b/src/commands/CmdAnnotate.cpp index 3528b55a7..d5ed7537c 100644 --- a/src/commands/CmdAnnotate.cpp +++ b/src/commands/CmdAnnotate.cpp @@ -87,7 +87,8 @@ int CmdAnnotate::execute (std::string& output) context.tdb2.modify (*task); ++count; - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_ANNO_DONE, task->id, task->get ("description")) @@ -98,7 +99,8 @@ int CmdAnnotate::execute (std::string& output) context.tdb2.commit (); - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format ((count == 1 ? STRING_CMD_ANNO_SUMMARY : STRING_CMD_ANNO_SUMMARY_N), diff --git a/src/commands/CmdAppend.cpp b/src/commands/CmdAppend.cpp index 93f5419be..540bb1d28 100644 --- a/src/commands/CmdAppend.cpp +++ b/src/commands/CmdAppend.cpp @@ -98,7 +98,8 @@ int CmdAppend::execute (std::string& output) { context.tdb2.modify (*sibling); - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_APPEND_DONE, sibling->id) << "\n"; @@ -113,7 +114,8 @@ int CmdAppend::execute (std::string& output) context.tdb2.commit (); - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format ((count == 1 ? STRING_CMD_APPEND_SUMMARY : STRING_CMD_APPEND_SUMMARY_N), diff --git a/src/commands/CmdDelete.cpp b/src/commands/CmdDelete.cpp index d1f77214b..08b1b171d 100644 --- a/src/commands/CmdDelete.cpp +++ b/src/commands/CmdDelete.cpp @@ -112,8 +112,8 @@ int CmdDelete::execute (std::string& output) context.tdb2.modify (*sibling); ++count; - // TODO Feedback. - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_DELETE_RECURRING, sibling->id, sibling->get ("description")) @@ -156,7 +156,8 @@ int CmdDelete::execute (std::string& output) context.tdb2.modify (*task); ++count; - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_DELETE_DELETING, task->id, task->get ("description")) diff --git a/src/commands/CmdDenotate.cpp b/src/commands/CmdDenotate.cpp index 06c5b1c3e..386f254de 100644 --- a/src/commands/CmdDenotate.cpp +++ b/src/commands/CmdDenotate.cpp @@ -121,7 +121,8 @@ int CmdDenotate::execute (std::string& output) { ++count; context.tdb2.modify (*task); - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_DENO_FOUND, anno) << "\n"; } diff --git a/src/commands/CmdDone.cpp b/src/commands/CmdDone.cpp index 464cc7999..447c3e9b2 100644 --- a/src/commands/CmdDone.cpp +++ b/src/commands/CmdDone.cpp @@ -93,7 +93,8 @@ int CmdDone::execute (std::string& output) context.tdb2.modify (*task); ++count; - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_DONE_COMPLETED, task->id, task->get ("description")) << "\n"; @@ -117,7 +118,8 @@ int CmdDone::execute (std::string& output) context.tdb2.commit (); - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format ((count == 1 ? STRING_CMD_DONE_MARKED : STRING_CMD_DONE_MARKED_N), diff --git a/src/commands/CmdDuplicate.cpp b/src/commands/CmdDuplicate.cpp index d52dd0e3a..928444a44 100644 --- a/src/commands/CmdDuplicate.cpp +++ b/src/commands/CmdDuplicate.cpp @@ -93,7 +93,8 @@ int CmdDuplicate::execute (std::string& output) context.tdb2.add (dup); ++count; - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_DUPLICATE_DONE, task->id, task->get ("description")) diff --git a/src/commands/CmdInfo.cpp b/src/commands/CmdInfo.cpp index c0fc2b972..038cbb9e4 100644 --- a/src/commands/CmdInfo.cpp +++ b/src/commands/CmdInfo.cpp @@ -284,7 +284,7 @@ int CmdInfo::execute (std::string& output) view.set (row, 1, entry + " (" + age + ")"); - // fg TODO deprecated + // fg TODO deprecated 2.0 std::string color = task->get ("fg"); if (color != "") { @@ -293,7 +293,7 @@ int CmdInfo::execute (std::string& output) view.set (row, 1, color); } - // bg TODO deprecated + // bg TODO deprecated 2.0 color = task->get ("bg"); if (color != "") { diff --git a/src/commands/CmdLog.cpp b/src/commands/CmdLog.cpp index d7dd9cfec..42d6f740f 100644 --- a/src/commands/CmdLog.cpp +++ b/src/commands/CmdLog.cpp @@ -69,7 +69,8 @@ int CmdLog::execute (std::string& output) context.footnote (onProjectChange (task)); context.tdb2.commit (); - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 output = std::string (STRING_CMD_LOG_LOGGED) + "\n"; return rc; diff --git a/src/commands/CmdModify.cpp b/src/commands/CmdModify.cpp index a7766489a..b2529fa7f 100644 --- a/src/commands/CmdModify.cpp +++ b/src/commands/CmdModify.cpp @@ -165,7 +165,8 @@ int CmdModify::execute (std::string& output) context.tdb2.commit (); - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 { if (count == 1) out << format (STRING_CMD_MODIFY_TASK, count) << "\n"; diff --git a/src/commands/CmdPrepend.cpp b/src/commands/CmdPrepend.cpp index 05ad1d579..c16d091b0 100644 --- a/src/commands/CmdPrepend.cpp +++ b/src/commands/CmdPrepend.cpp @@ -98,7 +98,8 @@ int CmdPrepend::execute (std::string& output) context.tdb2.modify (*sibling); ++changes; - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_PREPEND_DONE, sibling->id) << "\n"; @@ -113,7 +114,8 @@ int CmdPrepend::execute (std::string& output) context.tdb2.commit (); - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format ((count == 1 ? STRING_CMD_PREPEND_SUMMARY : STRING_CMD_PREPEND_SUMMARY_N), diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index 3c80e9878..7d68f516f 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -143,7 +143,7 @@ int CmdShow::execute (std::string& output) " displayweeknumber" " dom" " due" - " echo.command" + " echo.command" // Deprecated 2.0 " edit.verbose" " editor" " exit.on.missing.db" diff --git a/src/commands/CmdStart.cpp b/src/commands/CmdStart.cpp index 13eb94925..0811e12bb 100644 --- a/src/commands/CmdStart.cpp +++ b/src/commands/CmdStart.cpp @@ -93,7 +93,8 @@ int CmdStart::execute (std::string& output) context.tdb2.modify (*task); ++count; - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_START_DONE, task->id, task->get ("description")) diff --git a/src/commands/CmdStop.cpp b/src/commands/CmdStop.cpp index 8882e66f4..13a2de71b 100644 --- a/src/commands/CmdStop.cpp +++ b/src/commands/CmdStop.cpp @@ -92,7 +92,8 @@ int CmdStop::execute (std::string& output) context.tdb2.modify (*task); ++count; - if (context.config.getBoolean ("echo.command")) + if (context.verbose ("affected") || + context.config.getBoolean ("echo.command")) // Deprecated 2.0 out << format (STRING_CMD_STOP_DONE, task->id, task->get ("description")) diff --git a/src/util.cpp b/src/util.cpp index 2072fc109..6fbaae871 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -526,9 +526,9 @@ const std::string decode (const std::string& value) // Support for deprecated encodings. These cannot be removed or old files // will not be parsable. Not just old files - completed.data can contain // tasks formatted/encoded using these. - str_replace (modified, "&squot;", "'"); - str_replace (modified, ",", ","); - str_replace (modified, ":", ":"); + str_replace (modified, "&squot;", "'"); // Deprecated 2.0 + str_replace (modified, ",", ","); // Deprecated 2.0 + str_replace (modified, ":", ":"); // Deprecated 2.0 return modified; } diff --git a/test/verbose.t b/test/verbose.t new file mode 100755 index 000000000..dc0ede14a --- /dev/null +++ b/test/verbose.t @@ -0,0 +1,65 @@ +#! /usr/bin/perl +################################################################################ +## taskwarrior - a command line task list manager. +## +## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. +## 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 => 4; + +# Create the rc file. +if (open my $fh, '>', 'verbose.rc') +{ + print $fh "data.location=.\n", + "echo.command=off\n"; + close $fh; + ok (-r 'verbose.rc', 'Created verbose.rc'); +} + +# Verbosity: 'affected' +my $output = qx{../src/task rc:verbose.rc log foo rc.verbose:on}; +like ($output, qr/Logged task/, '\'affected\' verbosity good'); + +$output = qx{../src/task rc:verbose.rc log bar rc.verbose:off}; +unlike ($output, qr/Logged task/, '\'affected\' verbosity good'); + +# TODO Verbosity: 'new-id' +# TODO Verbosity: 'blank' +# TODO Verbosity: 'label' +# TODO Verbosity: 'header' +# TODO Verbosity: 'footer' + +# Cleanup. +unlink qw(pending.data completed.data undo.data backlog.data synch.key verbose.rc); +ok (! -r 'pending.data' && + ! -r 'completed.data' && + ! -r 'undo.data' && + ! -r 'backlog.data' && + ! -r 'synch.key' && + ! -r 'verbose.rc', 'Cleanup'); + +exit 0; +