Verbosity
- Added 'affected' verbosity token. - Deprecated 'rc.echo.command'. - Updated config defaults. - Labelled all deprecated 'echo.command' references with '// Deprecated 2.0' - Added unit tests to start the verbosity testing. Not complete. - Updated taskrc.5 man page.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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 != "")
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user