mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Performance
- Removed "std::endl" in cases where the autoflush is only going to slow things down.
This commit is contained in:
parent
dd86c2c875
commit
1d3aa891d6
4 changed files with 253 additions and 311 deletions
63
src/TDB.cpp
63
src/TDB.cpp
|
@ -52,9 +52,9 @@
|
||||||
#define DEBUG_OUTPUT 0
|
#define DEBUG_OUTPUT 0
|
||||||
|
|
||||||
#if DEBUG_OUTPUT > 0
|
#if DEBUG_OUTPUT > 0
|
||||||
#define DEBUG_STR(str) std::cout << "DEBUG: " << str << std::endl; std::cout.flush()
|
#define DEBUG_STR(str) std::cout << "DEBUG: " << str << "\n"; std::cout.flush()
|
||||||
#define DEBUG_STR_PART(str) std::cout << "DEBUG: " << str; std::cout.flush()
|
#define DEBUG_STR_PART(str) std::cout << "DEBUG: " << str; std::cout.flush()
|
||||||
#define DEBUG_STR_END(str) std::cout << str << std::endl; std::cout.flush()
|
#define DEBUG_STR_END(str) std::cout << str << "\n"; std::cout.flush()
|
||||||
#else
|
#else
|
||||||
#define DEBUG_STR(str)
|
#define DEBUG_STR(str)
|
||||||
#define DEBUG_STR_PART(str)
|
#define DEBUG_STR_PART(str)
|
||||||
|
@ -613,6 +613,9 @@ int TDB::gc ()
|
||||||
std::vector <Task> ignore;
|
std::vector <Task> ignore;
|
||||||
loadPending (ignore, filter);
|
loadPending (ignore, filter);
|
||||||
|
|
||||||
|
// TODO This whole idea of removing dangling dependencies is suspect. I'm not
|
||||||
|
// sure it should be included.
|
||||||
|
|
||||||
// Search for dangling dependencies. These are dependencies whose uuid cannot
|
// Search for dangling dependencies. These are dependencies whose uuid cannot
|
||||||
// be converted to an id by TDB.
|
// be converted to an id by TDB.
|
||||||
std::vector <std::string> deps;
|
std::vector <std::string> deps;
|
||||||
|
@ -758,10 +761,10 @@ void TDB::undo ()
|
||||||
|
|
||||||
if (context.config.get ("undo.style") == "side")
|
if (context.config.get ("undo.style") == "side")
|
||||||
{
|
{
|
||||||
std::cout << std::endl
|
std::cout << "\n"
|
||||||
<< "The last modification was made "
|
<< "The last modification was made "
|
||||||
<< lastChange.toString ()
|
<< lastChange.toString ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
// Attributes are all there is, so figure the different attribute names
|
// Attributes are all there is, so figure the different attribute names
|
||||||
// between before and after.
|
// between before and after.
|
||||||
|
@ -844,9 +847,9 @@ void TDB::undo ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << std::endl
|
std::cout << "\n"
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// This style looks like this:
|
// This style looks like this:
|
||||||
|
@ -977,15 +980,15 @@ void TDB::undo ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << std::endl
|
std::cout << "\n"
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output displayed, now confirm.
|
// Output displayed, now confirm.
|
||||||
if (!confirm ("The undo command is not reversible. Are you sure you want to revert to the previous state?"))
|
if (!confirm ("The undo command is not reversible. Are you sure you want to revert to the previous state?"))
|
||||||
{
|
{
|
||||||
std::cout << "No changes made." << std::endl;
|
std::cout << "No changes made.\n";
|
||||||
context.hooks.trigger ("post-undo");
|
context.hooks.trigger ("post-undo");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1013,12 +1016,12 @@ void TDB::undo ()
|
||||||
if (prior != "")
|
if (prior != "")
|
||||||
{
|
{
|
||||||
*task = prior;
|
*task = prior;
|
||||||
std::cout << "Modified task reverted." << std::endl;
|
std::cout << "Modified task reverted.\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.erase (task);
|
p.erase (task);
|
||||||
std::cout << "Task removed." << std::endl;
|
std::cout << "Task removed.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite files.
|
// Rewrite files.
|
||||||
|
@ -1050,7 +1053,7 @@ void TDB::undo ()
|
||||||
File::write (completedFile, c);
|
File::write (completedFile, c);
|
||||||
File::write (pendingFile, p);
|
File::write (pendingFile, p);
|
||||||
File::write (undoFile, u);
|
File::write (undoFile, u);
|
||||||
std::cout << "Modified task reverted." << std::endl;
|
std::cout << "Modified task reverted.\n";
|
||||||
context.debug ("TDB::undo - task belongs in pending.data");
|
context.debug ("TDB::undo - task belongs in pending.data");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1058,11 +1061,11 @@ void TDB::undo ()
|
||||||
*task = prior;
|
*task = prior;
|
||||||
File::write (completedFile, c);
|
File::write (completedFile, c);
|
||||||
File::write (undoFile, u);
|
File::write (undoFile, u);
|
||||||
std::cout << "Modified task reverted." << std::endl;
|
std::cout << "Modified task reverted.\n";
|
||||||
context.debug ("TDB::undo - task belongs in completed.data");
|
context.debug ("TDB::undo - task belongs in completed.data");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Undo complete." << std::endl;
|
std::cout << "Undo complete.\n";
|
||||||
context.hooks.trigger ("post-undo");
|
context.hooks.trigger ("post-undo");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1072,10 +1075,8 @@ void TDB::undo ()
|
||||||
// Perhaps the task was in completed.data, which was still in file format 3?
|
// Perhaps the task was in completed.data, which was still in file format 3?
|
||||||
std::cout << "Task with UUID "
|
std::cout << "Task with UUID "
|
||||||
<< uuid.substr (6, 36)
|
<< uuid.substr (6, 36)
|
||||||
<< " not found in data."
|
<< " not found in data.\n"
|
||||||
<< std::endl
|
<< "No undo possible.\n";
|
||||||
<< "No undo possible."
|
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1199,7 +1200,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
{
|
{
|
||||||
std::cout << "Skipping the new local task "
|
std::cout << "Skipping the new local task "
|
||||||
<< (*lmod_it).getUuid()
|
<< (*lmod_it).getUuid()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
uuid_left.insert ( (*lmod_it).getUuid ());
|
uuid_left.insert ( (*lmod_it).getUuid ());
|
||||||
}
|
}
|
||||||
|
@ -1223,7 +1224,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
{
|
{
|
||||||
std::cout << "Adding the new remote task "
|
std::cout << "Adding the new remote task "
|
||||||
<< tmod.getUuid()
|
<< tmod.getUuid()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
uuid_new.insert (tmod.getUuid ());
|
uuid_new.insert (tmod.getUuid ());
|
||||||
mods.push_back (tmod);
|
mods.push_back (tmod);
|
||||||
rmods.erase (current);
|
rmods.erase (current);
|
||||||
|
@ -1292,7 +1293,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
// which one is newer?
|
// which one is newer?
|
||||||
if (tmod_r > tmod_l)
|
if (tmod_r > tmod_l)
|
||||||
{
|
{
|
||||||
std::cout << "Applying remote changes for uuid " << uuid << std::endl;
|
std::cout << "Applying remote changes for uuid " << uuid << "\n";
|
||||||
|
|
||||||
mods.push_front(tmod_r);
|
mods.push_front(tmod_r);
|
||||||
|
|
||||||
|
@ -1305,7 +1306,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Rejecting remote changes for uuid " << uuid << std::endl;
|
std::cout << "Rejecting remote changes for uuid " << uuid << "\n";
|
||||||
// inserting right mod into history of local database
|
// inserting right mod into history of local database
|
||||||
// so that it can be restored later
|
// so that it can be restored later
|
||||||
|
|
||||||
|
@ -1361,7 +1362,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
else // lit == undo.end ()
|
else // lit == undo.end ()
|
||||||
{
|
{
|
||||||
// nothing happend on the local branch
|
// nothing happend on the local branch
|
||||||
std::cout << "No changes were made on the local database. Appending changes..." << std::endl;
|
std::cout << "No changes were made on the local database. Appending changes...\n";
|
||||||
|
|
||||||
// add remaining lines (remote branch) to the list of modifications
|
// add remaining lines (remote branch) to the list of modifications
|
||||||
readTaskmods (r, rit, mods);
|
readTaskmods (r, rit, mods);
|
||||||
|
@ -1372,7 +1373,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
|
|
||||||
if (!mods.empty ())
|
if (!mods.empty ())
|
||||||
{
|
{
|
||||||
std::cout << "Running redo routine..." << std::endl;
|
std::cout << "Running redo routine...\n";
|
||||||
|
|
||||||
std::string pendingFile = location.data + "/pending.data";
|
std::string pendingFile = location.data + "/pending.data";
|
||||||
std::vector <std::string> pending;
|
std::vector <std::string> pending;
|
||||||
|
@ -1411,7 +1412,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
if (it->find (uuid) != std::string::npos)
|
if (it->find (uuid) != std::string::npos)
|
||||||
{
|
{
|
||||||
// Update the completed record.
|
// Update the completed record.
|
||||||
std::cout << "Modifying " << uuid << std::endl;
|
std::cout << "Modifying " << uuid << "\n";
|
||||||
|
|
||||||
// remove the \n from composeF4() string
|
// remove the \n from composeF4() string
|
||||||
std::string newline = tmod.getAfter ().composeF4 ();
|
std::string newline = tmod.getAfter ().composeF4 ();
|
||||||
|
@ -1449,7 +1450,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
if (it->find (uuid) != std::string::npos)
|
if (it->find (uuid) != std::string::npos)
|
||||||
{
|
{
|
||||||
// Update the pending record.
|
// Update the pending record.
|
||||||
std::cout << "Modifying " << uuid << std::endl;
|
std::cout << "Modifying " << uuid << "\n";
|
||||||
|
|
||||||
// remove the \n from composeF4() string
|
// remove the \n from composeF4() string
|
||||||
// which will replace the current line
|
// which will replace the current line
|
||||||
|
@ -1481,7 +1482,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
std::cout << "Missing " << uuid << std::endl;
|
std::cout << "Missing " << uuid << "\n";
|
||||||
mods.erase (current);
|
mods.erase (current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1505,11 +1506,11 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
std::cout << "Adding " << uuid << std::endl;
|
std::cout << "Adding " << uuid << "\n";
|
||||||
pending.push_back (tmod.getAfter ().composeF4 ());
|
pending.push_back (tmod.getAfter ().composeF4 ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << "Not adding duplicate " << uuid << std::endl;
|
std::cout << "Not adding duplicate " << uuid << "\n";
|
||||||
mods.erase (current);
|
mods.erase (current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1539,7 +1540,7 @@ void TDB::merge (const std::string& mergeFile)
|
||||||
}
|
}
|
||||||
else // nothing to be done
|
else // nothing to be done
|
||||||
{
|
{
|
||||||
std::cout << "Nothing to be done." << std::endl;
|
std::cout << "Nothing to be done.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete objects
|
// delete objects
|
||||||
|
@ -1590,7 +1591,7 @@ FILE* TDB::openAndLock (const std::string& file)
|
||||||
if (mLock)
|
if (mLock)
|
||||||
while (flock (fileno (in), LOCK_NB | LOCK_EX) && ++retry <= 3)
|
while (flock (fileno (in), LOCK_NB | LOCK_EX) && ++retry <= 3)
|
||||||
{
|
{
|
||||||
std::cout << "Waiting for file lock..." << std::endl;
|
std::cout << "Waiting for file lock...\n";
|
||||||
while (flock (fileno (in), LOCK_NB | LOCK_EX) && ++retry <= 3)
|
while (flock (fileno (in), LOCK_NB | LOCK_EX) && ++retry <= 3)
|
||||||
delay (0.2);
|
delay (0.2);
|
||||||
}
|
}
|
||||||
|
|
261
src/command.cpp
261
src/command.cpp
|
@ -143,7 +143,7 @@ int handleAdd (std::string &outs)
|
||||||
context.tdb.add (context.task);
|
context.tdb.add (context.task);
|
||||||
|
|
||||||
#ifdef FEATURE_NEW_ID
|
#ifdef FEATURE_NEW_ID
|
||||||
out << "Created task " << context.tdb.nextId () << "." << std::endl;
|
out << "Created task " << context.tdb.nextId () << ".\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
out << onProjectChange (context.task);
|
out << onProjectChange (context.task);
|
||||||
|
@ -212,7 +212,7 @@ int handleLog (std::string &outs)
|
||||||
context.tdb.unlock ();
|
context.tdb.unlock ();
|
||||||
|
|
||||||
if (context.config.getBoolean ("echo.command"))
|
if (context.config.getBoolean ("echo.command"))
|
||||||
out << "Logged task." << std::endl;
|
out << "Logged task.\n";
|
||||||
|
|
||||||
out << onProjectChange (context.task);
|
out << onProjectChange (context.task);
|
||||||
|
|
||||||
|
@ -309,14 +309,11 @@ int handleProjects (std::string &outs)
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< unique.size ()
|
<< unique.size ()
|
||||||
<< (unique.size () == 1 ? " project" : " projects")
|
<< (unique.size () == 1 ? " project" : " projects")
|
||||||
<< " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")"
|
<< " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "No projects."
|
out << "No projects.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +348,7 @@ int handleCompletionProjects (std::string &outs)
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
foreach (project, unique)
|
foreach (project, unique)
|
||||||
if (project->first.length ())
|
if (project->first.length ())
|
||||||
out << project->first << std::endl;
|
out << project->first << "\n";
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -430,13 +427,11 @@ int handleTags (std::string &outs)
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< unique.size ()
|
<< unique.size ()
|
||||||
<< (unique.size () == 1 ? " tag" : " tags")
|
<< (unique.size () == 1 ? " tag" : " tags")
|
||||||
<< " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")"
|
<< " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "No tags."
|
out << "No tags.\n";
|
||||||
<< std::endl;
|
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +471,7 @@ int handleCompletionTags (std::string &outs)
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
foreach (tag, unique)
|
foreach (tag, unique)
|
||||||
out << tag->first << std::endl;
|
out << tag->first << "\n";
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -494,7 +489,7 @@ int handleCompletionCommands (std::string &outs)
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
foreach (command, commands)
|
foreach (command, commands)
|
||||||
out << *command << std::endl;
|
out << *command << "\n";
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -509,7 +504,7 @@ int handleCompletionConfig (std::string &outs)
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
foreach (config, configs)
|
foreach (config, configs)
|
||||||
out << *config << std::endl;
|
out << *config << "\n";
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -575,7 +570,7 @@ int handleCompletionIDs (std::string &outs)
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
foreach (id, ids)
|
foreach (id, ids)
|
||||||
out << *id << std::endl;
|
out << *id << "\n";
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -715,7 +710,7 @@ int handleVersion (std::string &outs)
|
||||||
|
|
||||||
Color bold ("bold");
|
Color bold ("bold");
|
||||||
|
|
||||||
out << std::endl
|
out << "\n"
|
||||||
<< ((context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
<< ((context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
||||||
? bold.colorize (PACKAGE)
|
? bold.colorize (PACKAGE)
|
||||||
: PACKAGE)
|
: PACKAGE)
|
||||||
|
@ -755,16 +750,14 @@ int handleVersion (std::string &outs)
|
||||||
<< "-lua"
|
<< "-lua"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< "Copyright (C) 2006 - 2010 P. Beckingham, F. Hernandez."
|
<< "Copyright (C) 2006 - 2010 P. Beckingham, F. Hernandez.\n"
|
||||||
<< std::endl
|
|
||||||
#ifdef HAVE_LIBLUA
|
#ifdef HAVE_LIBLUA
|
||||||
<< "Portions of this software Copyright (C) 1994 – 2008 Lua.org, PUC-Rio."
|
<< "Portions of this software Copyright (C) 1994 – 2008 Lua.org, PUC-Rio.\n"
|
||||||
<< std::endl
|
|
||||||
#endif
|
#endif
|
||||||
<< disclaimer.render ()
|
<< disclaimer.render ()
|
||||||
<< link.render ()
|
<< link.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
context.hooks.trigger ("post-version-command");
|
context.hooks.trigger ("post-version-command");
|
||||||
|
@ -912,25 +905,22 @@ int handleShow (std::string &outs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl
|
out << "\n"
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< (table.rowCount () == 0 ? "No matching configuration variables.\n" : "")
|
<< (table.rowCount () == 0 ? "No matching configuration variables.\n\n" : "\n");
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Display the unrecognized variables.
|
// Display the unrecognized variables.
|
||||||
if (unrecognized.size ())
|
if (unrecognized.size ())
|
||||||
{
|
{
|
||||||
out << "Your .taskrc file contains these unrecognized variables:"
|
out << "Your .taskrc file contains these unrecognized variables:\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
foreach (i, unrecognized)
|
foreach (i, unrecognized)
|
||||||
out << " " << *i << std::endl;
|
out << " " << *i << "\n";
|
||||||
|
|
||||||
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
||||||
out << std::endl
|
out << "\n These are highlighted in " << error.colorize ("color") << " above.";
|
||||||
<< " These are highlighted in " << error.colorize ("color") << " above.";
|
|
||||||
|
|
||||||
out << std::endl;
|
out << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << context.config.checkForDeprecatedColor ();
|
out << context.config.checkForDeprecatedColor ();
|
||||||
|
@ -970,13 +960,12 @@ int handleShow (std::string &outs)
|
||||||
|
|
||||||
if (missing_scripts.size ())
|
if (missing_scripts.size ())
|
||||||
{
|
{
|
||||||
out << "Your .taskrc file contains these missing or unreadable hook scripts:"
|
out << "Your .taskrc file contains these missing or unreadable hook scripts:\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
foreach (i, missing_scripts)
|
foreach (i, missing_scripts)
|
||||||
out << " " << *i << std::endl;
|
out << " " << *i << "\n";
|
||||||
|
|
||||||
out << std::endl;
|
out << "\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -987,8 +976,7 @@ int handleShow (std::string &outs)
|
||||||
annotations != "none")
|
annotations != "none")
|
||||||
out << "Configuration error: annotations contains an unrecognized value '"
|
out << "Configuration error: annotations contains an unrecognized value '"
|
||||||
<< annotations
|
<< annotations
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Check for bad values in rc.calendar.details.
|
// Check for bad values in rc.calendar.details.
|
||||||
std::string calendardetails = context.config.get ("calendar.details");
|
std::string calendardetails = context.config.get ("calendar.details");
|
||||||
|
@ -997,8 +985,7 @@ int handleShow (std::string &outs)
|
||||||
calendardetails != "none")
|
calendardetails != "none")
|
||||||
out << "Configuration error: calendar.details contains an unrecognized value '"
|
out << "Configuration error: calendar.details contains an unrecognized value '"
|
||||||
<< calendardetails
|
<< calendardetails
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Check for bad values in rc.calendar.holidays.
|
// Check for bad values in rc.calendar.holidays.
|
||||||
std::string calendarholidays = context.config.get ("calendar.holidays");
|
std::string calendarholidays = context.config.get ("calendar.holidays");
|
||||||
|
@ -1007,8 +994,7 @@ int handleShow (std::string &outs)
|
||||||
calendarholidays != "none")
|
calendarholidays != "none")
|
||||||
out << "Configuration error: calendar.holidays contains an unrecognized value '"
|
out << "Configuration error: calendar.holidays contains an unrecognized value '"
|
||||||
<< calendarholidays
|
<< calendarholidays
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Check for bad values in rc.default.priority.
|
// Check for bad values in rc.default.priority.
|
||||||
std::string defaultPriority = context.config.get ("default.priority");
|
std::string defaultPriority = context.config.get ("default.priority");
|
||||||
|
@ -1018,16 +1004,14 @@ int handleShow (std::string &outs)
|
||||||
defaultPriority != "")
|
defaultPriority != "")
|
||||||
out << "Configuration error: default.priority contains an unrecognized value '"
|
out << "Configuration error: default.priority contains an unrecognized value '"
|
||||||
<< defaultPriority
|
<< defaultPriority
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Verify installation. This is mentioned in the documentation as the way
|
// Verify installation. This is mentioned in the documentation as the way
|
||||||
// to ensure everything is properly installed.
|
// to ensure everything is properly installed.
|
||||||
|
|
||||||
if (all.size () == 0)
|
if (all.size () == 0)
|
||||||
{
|
{
|
||||||
out << "Configuration error: .taskrc contains no entries."
|
out << "Configuration error: .taskrc contains no entries.\n";
|
||||||
<< std::endl;
|
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1036,13 +1020,11 @@ int handleShow (std::string &outs)
|
||||||
|
|
||||||
if (location.data == "")
|
if (location.data == "")
|
||||||
out << "Configuration error: data.location not specified in .taskrc "
|
out << "Configuration error: data.location not specified in .taskrc "
|
||||||
"file."
|
"file.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
if (! location.exists ())
|
if (! location.exists ())
|
||||||
out << "Configuration error: data.location contains a directory name"
|
out << "Configuration error: data.location contains a directory name"
|
||||||
" that doesn't exist, or is unreadable."
|
" that doesn't exist, or is unreadable.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
|
@ -1159,11 +1141,10 @@ int handleConfig (std::string &outs)
|
||||||
File::write (context.config.original_file, contents);
|
File::write (context.config.original_file, contents);
|
||||||
out << "Config file "
|
out << "Config file "
|
||||||
<< context.config.original_file.data
|
<< context.config.original_file.data
|
||||||
<< " modified."
|
<< " modified.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out << "No changes made." << std::endl;
|
out << "No changes made.\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Specify the name of a config variable to modify.");
|
throw std::string ("Specify the name of a config variable to modify.");
|
||||||
|
@ -1241,8 +1222,7 @@ int handleDelete (std::string &outs)
|
||||||
<< sibling->id
|
<< sibling->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< sibling->get ("description")
|
<< sibling->get ("description")
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1263,8 +1243,7 @@ int handleDelete (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
dependencyChainOnComplete (*task);
|
dependencyChainOnComplete (*task);
|
||||||
out << onProjectChange (*task);
|
out << onProjectChange (*task);
|
||||||
|
@ -1286,15 +1265,14 @@ int handleDelete (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
dependencyChainOnComplete (*task);
|
dependencyChainOnComplete (*task);
|
||||||
out << onProjectChange (*task);
|
out << onProjectChange (*task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out << "Task not deleted." << std::endl;
|
out << "Task not deleted.\n";
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1351,8 +1329,7 @@ int handleStart (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
if (!nagged)
|
if (!nagged)
|
||||||
nagged = nag (*task);
|
nagged = nag (*task);
|
||||||
|
|
||||||
|
@ -1364,8 +1341,7 @@ int handleStart (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "' already started."
|
<< "' already started.\n";
|
||||||
<< std::endl;
|
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1415,8 +1391,7 @@ int handleStop (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1424,8 +1399,7 @@ int handleStop (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "' not started."
|
<< "' not started.\n";
|
||||||
<< std::endl;
|
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1500,8 +1474,7 @@ int handleDone (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
dependencyChainOnComplete (*task);
|
dependencyChainOnComplete (*task);
|
||||||
out << onProjectChange (*task, false);
|
out << onProjectChange (*task, false);
|
||||||
|
@ -1523,8 +1496,7 @@ int handleDone (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "' is neither pending nor waiting."
|
<< "' is neither pending nor waiting.\n";
|
||||||
<< std::endl;
|
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1538,8 +1510,7 @@ int handleDone (std::string &outs)
|
||||||
<< count
|
<< count
|
||||||
<< " task"
|
<< " task"
|
||||||
<< (count == 1 ? "" : "s")
|
<< (count == 1 ? "" : "s")
|
||||||
<< " as done."
|
<< " as done.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
context.hooks.trigger ("post-done-command");
|
context.hooks.trigger ("post-done-command");
|
||||||
|
@ -1610,8 +1581,7 @@ int handleModify (std::string &outs)
|
||||||
std::cout << "Task "
|
std::cout << "Task "
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " is a recurring task, and all other instances of this"
|
<< " is a recurring task, and all other instances of this"
|
||||||
<< " task will be modified."
|
<< " task will be modified.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
Task before (*other);
|
Task before (*other);
|
||||||
|
|
||||||
|
@ -1629,8 +1599,7 @@ int handleModify (std::string &outs)
|
||||||
|
|
||||||
std::cout << "Task "
|
std::cout << "Task "
|
||||||
<< other->id
|
<< other->id
|
||||||
<< " is now a recurring task."
|
<< " is now a recurring task.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply other deltas.
|
// Apply other deltas.
|
||||||
|
@ -1671,7 +1640,7 @@ int handleModify (std::string &outs)
|
||||||
context.tdb.unlock ();
|
context.tdb.unlock ();
|
||||||
|
|
||||||
if (context.config.getBoolean ("echo.command"))
|
if (context.config.getBoolean ("echo.command"))
|
||||||
out << "Modified " << count << " task" << (count == 1 ? "." : "s.") << std::endl;
|
out << "Modified " << count << " task" << (count == 1 ? ".\n" : "s.\n");
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
context.hooks.trigger ("post-modify-command");
|
context.hooks.trigger ("post-modify-command");
|
||||||
|
@ -1732,8 +1701,7 @@ int handleAppend (std::string &outs)
|
||||||
<< context.task.get ("description")
|
<< context.task.get ("description")
|
||||||
<< "' to task "
|
<< "' to task "
|
||||||
<< other->id
|
<< other->id
|
||||||
<< "."
|
<< ".\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
if (before.get ("project") != other->get ("project"))
|
if (before.get ("project") != other->get ("project"))
|
||||||
out << onProjectChange (before, *other);
|
out << onProjectChange (before, *other);
|
||||||
|
@ -1749,7 +1717,7 @@ int handleAppend (std::string &outs)
|
||||||
context.tdb.unlock ();
|
context.tdb.unlock ();
|
||||||
|
|
||||||
if (context.config.getBoolean ("echo.command"))
|
if (context.config.getBoolean ("echo.command"))
|
||||||
out << "Appended " << count << " task" << (count == 1 ? "." : "s.") << std::endl;
|
out << "Appended " << count << " task" << (count == 1 ? ".\n" : "s.\n");
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
context.hooks.trigger ("post-append-command");
|
context.hooks.trigger ("post-append-command");
|
||||||
|
@ -1812,8 +1780,7 @@ int handlePrepend (std::string &outs)
|
||||||
<< context.task.get ("description")
|
<< context.task.get ("description")
|
||||||
<< "' to task "
|
<< "' to task "
|
||||||
<< other->id
|
<< other->id
|
||||||
<< "."
|
<< ".\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
if (before.get ("project") != other->get ("project"))
|
if (before.get ("project") != other->get ("project"))
|
||||||
out << onProjectChange (before, *other);
|
out << onProjectChange (before, *other);
|
||||||
|
@ -1829,7 +1796,7 @@ int handlePrepend (std::string &outs)
|
||||||
context.tdb.unlock ();
|
context.tdb.unlock ();
|
||||||
|
|
||||||
if (context.config.getBoolean ("echo.command"))
|
if (context.config.getBoolean ("echo.command"))
|
||||||
out << "Prepended " << count << " task" << (count == 1 ? "." : "s.") << std::endl;
|
out << "Prepended " << count << " task" << (count == 1 ? ".\n" : "s.\n");
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
context.hooks.trigger ("post-prepend-command");
|
context.hooks.trigger ("post-prepend-command");
|
||||||
|
@ -1875,8 +1842,7 @@ int handleDuplicate (std::string &outs)
|
||||||
|
|
||||||
out << "Note: task "
|
out << "Note: task "
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " was a recurring task. The new task is not."
|
<< " was a recurring task. The new task is not.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply deltas.
|
// Apply deltas.
|
||||||
|
@ -1897,8 +1863,7 @@ int handleDuplicate (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
out << onProjectChange (dup);
|
out << onProjectChange (dup);
|
||||||
|
|
||||||
|
@ -1907,13 +1872,13 @@ int handleDuplicate (std::string &outs)
|
||||||
|
|
||||||
if (context.config.getBoolean ("echo.command"))
|
if (context.config.getBoolean ("echo.command"))
|
||||||
{
|
{
|
||||||
out << "Duplicated " << count << " task" << (count == 1 ? "." : "s.") << std::endl;
|
out << "Duplicated " << count << " task" << (count == 1 ? ".\n" : "s.\n");
|
||||||
#ifdef FEATURE_NEW_ID
|
#ifdef FEATURE_NEW_ID
|
||||||
// All this, just for an id number.
|
// All this, just for an id number.
|
||||||
std::vector <Task> all;
|
std::vector <Task> all;
|
||||||
Filter none;
|
Filter none;
|
||||||
context.tdb.loadPending (all, none);
|
context.tdb.loadPending (all, none);
|
||||||
out << "Created task " << context.tdb.nextId () << "." << std::endl;
|
out << "Created task " << context.tdb.nextId () << ".\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1938,16 +1903,10 @@ void handleShell ()
|
||||||
std::cout << ((context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
std::cout << ((context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
||||||
? bold.colorize (PACKAGE_STRING)
|
? bold.colorize (PACKAGE_STRING)
|
||||||
: PACKAGE_STRING)
|
: PACKAGE_STRING)
|
||||||
<< " shell"
|
<< " shell\n\n"
|
||||||
<< std::endl
|
<< "Enter any task command (such as 'list'), or hit 'Enter'.\n"
|
||||||
<< std::endl
|
<< "There is no need to include the 'task' command itself.\n"
|
||||||
<< "Enter any task command (such as 'list'), or hit 'Enter'."
|
<< "Enter 'quit' to end the session.\n\n";
|
||||||
<< std::endl
|
|
||||||
<< "There is no need to include the 'task' command itself."
|
|
||||||
<< std::endl
|
|
||||||
<< "Enter 'quit' to end the session."
|
|
||||||
<< std::endl
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Make a copy because context.clear will delete them.
|
// Make a copy because context.clear will delete them.
|
||||||
std::string permanentOverrides = " " + context.file_override
|
std::string permanentOverrides = " " + context.file_override
|
||||||
|
@ -1995,12 +1954,12 @@ void handleShell ()
|
||||||
|
|
||||||
catch (std::string& error)
|
catch (std::string& error)
|
||||||
{
|
{
|
||||||
std::cout << error << std::endl;
|
std::cout << error << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::cerr << context.stringtable.get (100, "Unknown error.") << std::endl;
|
std::cerr << context.stringtable.get (100, "Unknown error.") << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2029,9 +1988,7 @@ int handleColor (std::string &outs)
|
||||||
std::string description = context.task.get ("description");
|
std::string description = context.task.get ("description");
|
||||||
if (description.find ("legend") != std::string::npos)
|
if (description.find ("legend") != std::string::npos)
|
||||||
{
|
{
|
||||||
out << std::endl
|
out << "\nHere are the colors currently in use:\n";
|
||||||
<< "Here are the colors currently in use:"
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
std::vector <std::string> all;
|
std::vector <std::string> all;
|
||||||
context.config.all (all);
|
context.config.all (all);
|
||||||
|
@ -2065,7 +2022,7 @@ int handleColor (std::string &outs)
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is something in the description, then assume that is a color,
|
// If there is something in the description, then assume that is a color,
|
||||||
|
@ -2080,30 +2037,29 @@ int handleColor (std::string &outs)
|
||||||
Color six ("red on color173");
|
Color six ("red on color173");
|
||||||
Color sample (description);
|
Color sample (description);
|
||||||
|
|
||||||
out << std::endl
|
out << "\n"
|
||||||
<< "Use this command to see how colors are displayed by your terminal." << std::endl
|
<< "Use this command to see how colors are displayed by your terminal.\n\n"
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< "16-color usage (supports underline, bold text, bright background):" << std::endl
|
<< "16-color usage (supports underline, bold text, bright background):\n"
|
||||||
<< " " << one.colorize ("task color black on bright yellow") << std::endl
|
<< " " << one.colorize ("task color black on bright yellow") << "\n"
|
||||||
<< " " << two.colorize ("task color underline cyan on bright blue") << std::endl
|
<< " " << two.colorize ("task color underline cyan on bright blue") << "\n"
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< "256-color usage (supports underline):" << std::endl
|
<< "256-color usage (supports underline):\n"
|
||||||
<< " " << three.colorize ("task color color214 on color202") << std::endl
|
<< " " << three.colorize ("task color color214 on color202") << "\n"
|
||||||
<< " " << four.colorize ("task color rgb150 on rgb020") << std::endl
|
<< " " << four.colorize ("task color rgb150 on rgb020") << "\n"
|
||||||
<< " " << five.colorize ("task color underline grey10 on grey3") << std::endl
|
<< " " << five.colorize ("task color underline grey10 on grey3") << "\n"
|
||||||
<< " " << six.colorize ("task color red on color173") << std::endl
|
<< " " << six.colorize ("task color red on color173") << "\n"
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< "Your sample:" << std::endl
|
<< "Your sample:" << "\n"
|
||||||
<< " " << sample.colorize ("task color " + description) << std::endl
|
<< " " << sample.colorize ("task color " + description) << "\n\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show all supported colors. Possibly show some unsupported ones too.
|
// Show all supported colors. Possibly show some unsupported ones too.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << std::endl
|
out << "\n"
|
||||||
<< "Basic colors"
|
<< "Basic colors"
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< " " << Color::colorize (" black ", "black")
|
<< " " << Color::colorize (" black ", "black")
|
||||||
<< " " << Color::colorize (" red ", "red")
|
<< " " << Color::colorize (" red ", "red")
|
||||||
<< " " << Color::colorize (" blue ", "blue")
|
<< " " << Color::colorize (" blue ", "blue")
|
||||||
|
@ -2112,7 +2068,7 @@ int handleColor (std::string &outs)
|
||||||
<< " " << Color::colorize (" cyan ", "cyan")
|
<< " " << Color::colorize (" cyan ", "cyan")
|
||||||
<< " " << Color::colorize (" yellow ", "yellow")
|
<< " " << Color::colorize (" yellow ", "yellow")
|
||||||
<< " " << Color::colorize (" white ", "white")
|
<< " " << Color::colorize (" white ", "white")
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< " " << Color::colorize (" black ", "white on black")
|
<< " " << Color::colorize (" black ", "white on black")
|
||||||
<< " " << Color::colorize (" red ", "white on red")
|
<< " " << Color::colorize (" red ", "white on red")
|
||||||
<< " " << Color::colorize (" blue ", "white on blue")
|
<< " " << Color::colorize (" blue ", "white on blue")
|
||||||
|
@ -2121,24 +2077,21 @@ int handleColor (std::string &outs)
|
||||||
<< " " << Color::colorize (" cyan ", "black on cyan")
|
<< " " << Color::colorize (" cyan ", "black on cyan")
|
||||||
<< " " << Color::colorize (" yellow ", "black on yellow")
|
<< " " << Color::colorize (" yellow ", "black on yellow")
|
||||||
<< " " << Color::colorize (" white ", "black on white")
|
<< " " << Color::colorize (" white ", "black on white")
|
||||||
<< std::endl
|
<< "\n\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
out << "Effects"
|
out << "Effects"
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< " " << Color::colorize (" red ", "red")
|
<< " " << Color::colorize (" red ", "red")
|
||||||
<< " " << Color::colorize (" bold red ", "bold red")
|
<< " " << Color::colorize (" bold red ", "bold red")
|
||||||
<< " " << Color::colorize (" underline on blue ", "underline on blue")
|
<< " " << Color::colorize (" underline on blue ", "underline on blue")
|
||||||
<< " " << Color::colorize (" on green ", "black on green")
|
<< " " << Color::colorize (" on green ", "black on green")
|
||||||
<< " " << Color::colorize (" on bright green ", "black on bright green")
|
<< " " << Color::colorize (" on bright green ", "black on bright green")
|
||||||
<< std::endl
|
<< "\n\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// 16 system colors.
|
// 16 system colors.
|
||||||
out << "color0 - color15"
|
out << "color0 - color15"
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< " 0 1 2 . . ."
|
<< " 0 1 2 . . .\n";
|
||||||
<< std::endl;
|
|
||||||
for (int r = 0; r < 2; ++r)
|
for (int r = 0; r < 2; ++r)
|
||||||
{
|
{
|
||||||
out << " ";
|
out << " ";
|
||||||
|
@ -2149,12 +2102,10 @@ int handleColor (std::string &outs)
|
||||||
out << Color::colorize (" ", s.str ());
|
out << Color::colorize (" ", s.str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl;
|
out << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << " . . . 15"
|
out << " . . . 15\n\n";
|
||||||
<< std::endl
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Color cube.
|
// Color cube.
|
||||||
out << "Color cube rgb"
|
out << "Color cube rgb"
|
||||||
|
@ -2166,21 +2117,21 @@ int handleColor (std::string &outs)
|
||||||
<< Color::colorize ("5", "bold green")
|
<< Color::colorize ("5", "bold green")
|
||||||
<< Color::colorize ("5", "bold blue")
|
<< Color::colorize ("5", "bold blue")
|
||||||
<< " (also color16 - color231)"
|
<< " (also color16 - color231)"
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< " " << Color::colorize ("0 "
|
<< " " << Color::colorize ("0 "
|
||||||
"1 "
|
"1 "
|
||||||
"2 "
|
"2 "
|
||||||
"3 "
|
"3 "
|
||||||
"4 "
|
"4 "
|
||||||
"5", "bold red")
|
"5", "bold red")
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< " " << Color::colorize ("0 1 2 3 4 5 "
|
<< " " << Color::colorize ("0 1 2 3 4 5 "
|
||||||
"0 1 2 3 4 5 "
|
"0 1 2 3 4 5 "
|
||||||
"0 1 2 3 4 5 "
|
"0 1 2 3 4 5 "
|
||||||
"0 1 2 3 4 5 "
|
"0 1 2 3 4 5 "
|
||||||
"0 1 2 3 4 5 "
|
"0 1 2 3 4 5 "
|
||||||
"0 1 2 3 4 5", "bold blue")
|
"0 1 2 3 4 5", "bold blue")
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
char label [12];
|
char label [12];
|
||||||
for (int g = 0; g < 6; ++g)
|
for (int g = 0; g < 6; ++g)
|
||||||
|
@ -2199,16 +2150,14 @@ int handleColor (std::string &outs)
|
||||||
out << " ";
|
out << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl;
|
out << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl;
|
out << "\n";
|
||||||
|
|
||||||
// Grey ramp.
|
// Grey ramp.
|
||||||
out << "Gray ramp gray0 - gray23 (also color232 - color255)"
|
out << "Gray ramp gray0 - gray23 (also color232 - color255)\n"
|
||||||
<< std::endl
|
<< " 0 1 2 . . . . . . 23\n"
|
||||||
<< " 0 1 2 . . . . . . 23"
|
|
||||||
<< std::endl
|
|
||||||
<< " ";
|
<< " ";
|
||||||
for (int g = 0; g < 24; ++g)
|
for (int g = 0; g < 24; ++g)
|
||||||
{
|
{
|
||||||
|
@ -2217,18 +2166,13 @@ int handleColor (std::string &outs)
|
||||||
out << Color::colorize (" ", s.str ());
|
out << Color::colorize (" ", s.str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl
|
out << "\n\nTry running 'task color white on red'.\n\n";
|
||||||
<< std::endl
|
|
||||||
<< "Try running 'task color white on red'."
|
|
||||||
<< std::endl
|
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "Color is currently turned off in your .taskrc file. To enable "
|
out << "Color is currently turned off in your .taskrc file. To enable "
|
||||||
"color, remove the line 'color=off', or change the 'off' to 'on'."
|
"color, remove the line 'color=off', or change the 'off' to 'on'.\n";
|
||||||
<< std::endl;
|
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2282,8 +2226,7 @@ int handleAnnotate (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " with '"
|
<< " with '"
|
||||||
<< context.task.get ("description")
|
<< context.task.get ("description")
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2375,15 +2318,13 @@ int handleDenotate (std::string &outs)
|
||||||
if (context.config.getBoolean ("echo.command"))
|
if (context.config.getBoolean ("echo.command"))
|
||||||
out << "Found annotation '"
|
out << "Found annotation '"
|
||||||
<< anno
|
<< anno
|
||||||
<< "' and deleted it."
|
<< "' and deleted it.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out << "Did not find any matching annotation to be deleted for '"
|
out << "Did not find any matching annotation to be deleted for '"
|
||||||
<< desc
|
<< desc
|
||||||
<< "'."
|
<< "'.\n";
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.tdb.commit ();
|
context.tdb.commit ();
|
||||||
|
|
158
src/edit.cpp
158
src/edit.cpp
|
@ -112,52 +112,52 @@ static std::string formatDate (
|
||||||
static std::string formatTask (Task task)
|
static std::string formatTask (Task task)
|
||||||
{
|
{
|
||||||
std::stringstream before;
|
std::stringstream before;
|
||||||
before << "# The 'task edit <id>' command allows you to modify all aspects of a task" << std::endl
|
before << "# The 'task edit <id>' command allows you to modify all aspects of a task\n"
|
||||||
<< "# using a text editor. What is shown below is a representation of the" << std::endl
|
<< "# using a text editor. What is shown below is a representation of the\n"
|
||||||
<< "# task in all it's detail. Modify what you wish, and if you save and" << std::endl
|
<< "# task in all it's detail. Modify what you wish, and if you save and\n"
|
||||||
<< "# quit your editor, taskwarrior will read this file and try to make sense" << std::endl
|
<< "# quit your editor, taskwarrior will read this file and try to make sense\n"
|
||||||
<< "# of what changed, and apply those changes. If you quit your editor" << std::endl
|
<< "# of what changed, and apply those changes. If you quit your editor\n"
|
||||||
<< "# without saving or making any modifications, taskwarrior will do nothing."<< std::endl
|
<< "# without saving or making any modifications, taskwarrior will do nothing.\n"
|
||||||
<< "#" << std::endl
|
<< "#\n"
|
||||||
<< "# Lines that begin with # represent data you cannot change, like ID." << std::endl
|
<< "# Lines that begin with # represent data you cannot change, like ID.\n"
|
||||||
<< "# If you get too 'creative' with your editing, taskwarrior will dump you" << std::endl
|
<< "# If you get too 'creative' with your editing, taskwarrior will dump you\n"
|
||||||
<< "# back into the editor to try again." << std::endl
|
<< "# back into the editor to try again.\n"
|
||||||
<< "#" << std::endl
|
<< "#\n"
|
||||||
<< "# Should you find yourself in an endless Groundhog Day loop, editing and" << std::endl
|
<< "# Should you find yourself in an endless Groundhog Day loop, editing and\n"
|
||||||
<< "# editing the same file, just quit the editor without making any changes." << std::endl
|
<< "# editing the same file, just quit the editor without making any changes.\n"
|
||||||
<< "# Taskwarrior will notice this and stop the editing." << std::endl
|
<< "# Taskwarrior will notice this and stop the editing.\n"
|
||||||
<< "#" << std::endl
|
<< "#\n"
|
||||||
<< "# Name Editable details" << std::endl
|
<< "# Name Editable details\n"
|
||||||
<< "# ----------------- ----------------------------------------------------" << std::endl
|
<< "# ----------------- ----------------------------------------------------\n"
|
||||||
<< "# ID: " << task.id << std::endl
|
<< "# ID: " << task.id << "\n"
|
||||||
<< "# UUID: " << task.get ("uuid") << std::endl
|
<< "# UUID: " << task.get ("uuid") << "\n"
|
||||||
<< "# Status: " << ucFirst (Task::statusToText (task.getStatus ())) << std::endl
|
<< "# Status: " << ucFirst (Task::statusToText (task.getStatus ())) << "\n"
|
||||||
<< "# Mask: " << task.get ("mask") << std::endl
|
<< "# Mask: " << task.get ("mask") << "\n"
|
||||||
<< "# iMask: " << task.get ("imask") << std::endl
|
<< "# iMask: " << task.get ("imask") << "\n"
|
||||||
<< " Project: " << task.get ("project") << std::endl
|
<< " Project: " << task.get ("project") << "\n"
|
||||||
<< " Priority: " << task.get ("priority") << std::endl;
|
<< " Priority: " << task.get ("priority") << "\n";
|
||||||
|
|
||||||
std::vector <std::string> tags;
|
std::vector <std::string> tags;
|
||||||
task.getTags (tags);
|
task.getTags (tags);
|
||||||
std::string allTags;
|
std::string allTags;
|
||||||
join (allTags, " ", tags);
|
join (allTags, " ", tags);
|
||||||
before << "# Separate the tags with spaces, like this: tag1 tag2" << std::endl
|
before << "# Separate the tags with spaces, like this: tag1 tag2\n"
|
||||||
<< " Tags: " << allTags << std::endl
|
<< " Tags: " << allTags << "\n"
|
||||||
<< "# The description field is allowed to wrap and use multiple lines. Task" << std::endl
|
<< "# The description field is allowed to wrap and use multiple lines. Task\n"
|
||||||
<< "# will combine them." << std::endl
|
<< "# will combine them.\n"
|
||||||
<< " Description: " << task.get ("description") << std::endl
|
<< " Description: " << task.get ("description") << "\n"
|
||||||
<< " Created: " << formatDate (task, "entry") << std::endl
|
<< " Created: " << formatDate (task, "entry") << "\n"
|
||||||
<< " Started: " << formatDate (task, "start") << std::endl
|
<< " Started: " << formatDate (task, "start") << "\n"
|
||||||
<< " Ended: " << formatDate (task, "end") << std::endl
|
<< " Ended: " << formatDate (task, "end") << "\n"
|
||||||
<< " Due: " << formatDate (task, "due") << std::endl
|
<< " Due: " << formatDate (task, "due") << "\n"
|
||||||
<< " Until: " << formatDate (task, "until") << std::endl
|
<< " Until: " << formatDate (task, "until") << "\n"
|
||||||
<< " Recur: " << task.get ("recur") << std::endl
|
<< " Recur: " << task.get ("recur") << "\n"
|
||||||
<< " Wait until: " << formatDate (task, "wait") << std::endl
|
<< " Wait until: " << formatDate (task, "wait") << "\n"
|
||||||
<< " Parent: " << task.get ("parent") << std::endl
|
<< " Parent: " << task.get ("parent") << "\n"
|
||||||
<< " Foreground color: " << task.get ("fg") << std::endl
|
<< " Foreground color: " << task.get ("fg") << "\n"
|
||||||
<< " Background color: " << task.get ("bg") << std::endl
|
<< " Background color: " << task.get ("bg") << "\n"
|
||||||
<< "# Annotations look like this: <date> -- <text> and there can be any number of them" << std::endl
|
<< "# Annotations look like this: <date> -- <text> and there can be any number of them\n"
|
||||||
<< "# ' -- ' is the separator between the date and text field. It should not be removed" << std::endl;
|
<< "# ' -- ' is the separator between the date and text field. It should not be removed\n";
|
||||||
|
|
||||||
std::vector <Att> annotations;
|
std::vector <Att> annotations;
|
||||||
task.getAnnotations (annotations);
|
task.getAnnotations (annotations);
|
||||||
|
@ -165,12 +165,12 @@ static std::string formatTask (Task task)
|
||||||
{
|
{
|
||||||
Date dt (::atoi (anno->name ().substr (11).c_str ()));
|
Date dt (::atoi (anno->name ().substr (11).c_str ()));
|
||||||
before << " Annotation: " << dt.toString (context.config.get ("dateformat.annotation"))
|
before << " Annotation: " << dt.toString (context.config.get ("dateformat.annotation"))
|
||||||
<< " -- " << anno->value () << std::endl;
|
<< " -- " << anno->value () << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
Date now;
|
Date now;
|
||||||
before << " Annotation: " << now.toString (context.config.get ("dateformat.annotation")) << " -- " << std::endl
|
before << " Annotation: " << now.toString (context.config.get ("dateformat.annotation")) << " -- \n"
|
||||||
<< "# End" << std::endl;
|
<< "# End\n";
|
||||||
|
|
||||||
// TODO Add dependencies here.
|
// TODO Add dependencies here.
|
||||||
|
|
||||||
|
@ -186,12 +186,12 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
std::cout << "Project modified." << std::endl;
|
std::cout << "Project modified.\n";
|
||||||
task.set ("project", value);
|
task.set ("project", value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Project deleted." << std::endl;
|
std::cout << "Project deleted.\n";
|
||||||
task.remove ("project");
|
task.remove ("project");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,13 +204,13 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (Att::validNameValue ("priority", "", value))
|
if (Att::validNameValue ("priority", "", value))
|
||||||
{
|
{
|
||||||
std::cout << "Priority modified." << std::endl;
|
std::cout << "Priority modified.\n";
|
||||||
task.set ("priority", value);
|
task.set ("priority", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Priority deleted." << std::endl;
|
std::cout << "Priority deleted.\n";
|
||||||
task.remove ("priority");
|
task.remove ("priority");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
std::cout << "Description modified." << std::endl;
|
std::cout << "Description modified.\n";
|
||||||
task.set ("description", value);
|
task.set ("description", value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -244,7 +244,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
Date original (::atoi (task.get ("entry").c_str ()));
|
Date original (::atoi (task.get ("entry").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Creation date modified." << std::endl;
|
std::cout << "Creation date modified.\n";
|
||||||
task.set ("entry", value);
|
task.set ("entry", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,13 +262,13 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
Date original (::atoi (task.get ("start").c_str ()));
|
Date original (::atoi (task.get ("start").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Start date modified." << std::endl;
|
std::cout << "Start date modified.\n";
|
||||||
task.set ("start", value);
|
task.set ("start", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Start date modified." << std::endl;
|
std::cout << "Start date modified.\n";
|
||||||
task.set ("start", value);
|
task.set ("start", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (task.get ("start") != "")
|
if (task.get ("start") != "")
|
||||||
{
|
{
|
||||||
std::cout << "Start date removed." << std::endl;
|
std::cout << "Start date removed.\n";
|
||||||
task.remove ("start");
|
task.remove ("start");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
Date original (::atoi (task.get ("end").c_str ()));
|
Date original (::atoi (task.get ("end").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Done date modified." << std::endl;
|
std::cout << "Done date modified.\n";
|
||||||
task.set ("end", value);
|
task.set ("end", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (task.get ("end") != "")
|
if (task.get ("end") != "")
|
||||||
{
|
{
|
||||||
std::cout << "Done date removed." << std::endl;
|
std::cout << "Done date removed.\n";
|
||||||
task.setStatus (Task::pending);
|
task.setStatus (Task::pending);
|
||||||
task.remove ("end");
|
task.remove ("end");
|
||||||
}
|
}
|
||||||
|
@ -320,13 +320,13 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
Date original (::atoi (task.get ("due").c_str ()));
|
Date original (::atoi (task.get ("due").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Due date modified." << std::endl;
|
std::cout << "Due date modified.\n";
|
||||||
task.set ("due", value);
|
task.set ("due", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Due date modified." << std::endl;
|
std::cout << "Due date modified.\n";
|
||||||
task.set ("due", value);
|
task.set ("due", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,11 +337,11 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
if (task.getStatus () == Task::recurring ||
|
if (task.getStatus () == Task::recurring ||
|
||||||
task.get ("parent") != "")
|
task.get ("parent") != "")
|
||||||
{
|
{
|
||||||
std::cout << "Cannot remove a due date from a recurring task." << std::endl;
|
std::cout << "Cannot remove a due date from a recurring task.\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Due date removed." << std::endl;
|
std::cout << "Due date removed.\n";
|
||||||
task.remove ("due");
|
task.remove ("due");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,13 +358,13 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
Date original (::atoi (task.get ("until").c_str ()));
|
Date original (::atoi (task.get ("until").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Until date modified." << std::endl;
|
std::cout << "Until date modified.\n";
|
||||||
task.set ("until", value);
|
task.set ("until", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Until date modified." << std::endl;
|
std::cout << "Until date modified.\n";
|
||||||
task.set ("until", value);
|
task.set ("until", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (task.get ("until") != "")
|
if (task.get ("until") != "")
|
||||||
{
|
{
|
||||||
std::cout << "Until date removed." << std::endl;
|
std::cout << "Until date removed.\n";
|
||||||
task.remove ("until");
|
task.remove ("until");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
Duration d;
|
Duration d;
|
||||||
if (d.valid (value))
|
if (d.valid (value))
|
||||||
{
|
{
|
||||||
std::cout << "Recurrence modified." << std::endl;
|
std::cout << "Recurrence modified.\n";
|
||||||
if (task.get ("due") != "")
|
if (task.get ("due") != "")
|
||||||
{
|
{
|
||||||
task.set ("recur", value);
|
task.set ("recur", value);
|
||||||
|
@ -400,7 +400,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Recurrence removed." << std::endl;
|
std::cout << "Recurrence removed.\n";
|
||||||
task.setStatus (Task::pending);
|
task.setStatus (Task::pending);
|
||||||
task.remove ("recur");
|
task.remove ("recur");
|
||||||
task.remove ("until");
|
task.remove ("until");
|
||||||
|
@ -420,13 +420,13 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
Date original (::atoi (task.get ("wait").c_str ()));
|
Date original (::atoi (task.get ("wait").c_str ()));
|
||||||
if (!original.sameDay (edited))
|
if (!original.sameDay (edited))
|
||||||
{
|
{
|
||||||
std::cout << "Wait date modified." << std::endl;
|
std::cout << "Wait date modified.\n";
|
||||||
task.set ("wait", value);
|
task.set ("wait", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Wait date modified." << std::endl;
|
std::cout << "Wait date modified.\n";
|
||||||
task.set ("wait", value);
|
task.set ("wait", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (task.get ("wait") != "")
|
if (task.get ("wait") != "")
|
||||||
{
|
{
|
||||||
std::cout << "Wait date removed." << std::endl;
|
std::cout << "Wait date removed.\n";
|
||||||
task.remove ("wait");
|
task.remove ("wait");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,12 +445,12 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
std::cout << "Parent UUID modified." << std::endl;
|
std::cout << "Parent UUID modified.\n";
|
||||||
task.set ("parent", value);
|
task.set ("parent", value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Parent UUID removed." << std::endl;
|
std::cout << "Parent UUID removed.\n";
|
||||||
task.remove ("parent");
|
task.remove ("parent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,12 +461,12 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
std::cout << "Foreground color modified." << std::endl;
|
std::cout << "Foreground color modified.\n";
|
||||||
task.set ("fg", value);
|
task.set ("fg", value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Foreground color removed." << std::endl;
|
std::cout << "Foreground color removed.\n";
|
||||||
task.remove ("fg");
|
task.remove ("fg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,12 +477,12 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
{
|
{
|
||||||
if (value != "")
|
if (value != "")
|
||||||
{
|
{
|
||||||
std::cout << "Background color modified." << std::endl;
|
std::cout << "Background color modified.\n";
|
||||||
task.set ("bg", value);
|
task.set ("bg", value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Background color removed." << std::endl;
|
std::cout << "Background color removed.\n";
|
||||||
task.remove ("bg");
|
task.remove ("bg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,11 +557,11 @@ void editFile (Task& task)
|
||||||
|
|
||||||
ARE_THESE_REALLY_HARMFUL:
|
ARE_THESE_REALLY_HARMFUL:
|
||||||
// Launch the editor.
|
// Launch the editor.
|
||||||
std::cout << "Launching '" << editor << "' now..." << std::endl;
|
std::cout << "Launching '" << editor << "' now...\n";
|
||||||
if (-1 == system (editor.c_str ()))
|
if (-1 == system (editor.c_str ()))
|
||||||
std::cout << "No editing performed." << std::endl;
|
std::cout << "No editing performed.\n";
|
||||||
else
|
else
|
||||||
std::cout << "Editing complete." << std::endl;
|
std::cout << "Editing complete.\n";
|
||||||
|
|
||||||
// Slurp file.
|
// Slurp file.
|
||||||
std::string after;
|
std::string after;
|
||||||
|
@ -571,7 +571,7 @@ ARE_THESE_REALLY_HARMFUL:
|
||||||
// if changes were made.
|
// if changes were made.
|
||||||
if (before != after)
|
if (before != after)
|
||||||
{
|
{
|
||||||
std::cout << "Edits were detected." << std::endl;
|
std::cout << "Edits were detected.\n";
|
||||||
std::string problem = "";
|
std::string problem = "";
|
||||||
bool oops = false;
|
bool oops = false;
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ ARE_THESE_REALLY_HARMFUL:
|
||||||
|
|
||||||
if (oops)
|
if (oops)
|
||||||
{
|
{
|
||||||
std::cout << "Error: " << problem << std::endl;
|
std::cout << "Error: " << problem << "\n";
|
||||||
|
|
||||||
// Preserve the edits.
|
// Preserve the edits.
|
||||||
before = after;
|
before = after;
|
||||||
|
@ -599,7 +599,7 @@ ARE_THESE_REALLY_HARMFUL:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << "No edits were detected." << std::endl;
|
std::cout << "No edits were detected.\n";
|
||||||
|
|
||||||
// Cleanup.
|
// Cleanup.
|
||||||
File::remove (file.str ());
|
File::remove (file.str ());
|
||||||
|
|
|
@ -253,12 +253,12 @@ int shortUsage (std::string &outs)
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
out << table.render ()
|
out << table.render ()
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< "Documentation for taskwarrior can be found using 'man task', "
|
<< "Documentation for taskwarrior can be found using 'man task', "
|
||||||
<< "'man taskrc', 'man task-tutorial', 'man task-color', 'man task-faq' "
|
<< "'man taskrc', 'man task-tutorial', 'man task-color', 'man task-faq' "
|
||||||
<< "or at http://taskwarrior.org"
|
<< "or at http://taskwarrior.org"
|
||||||
<< std::endl
|
<< "\n"
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -336,7 +336,7 @@ int longUsage (std::string &outs)
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "Many characters have special meaning to the shell, including:" << "\n"
|
<< "Many characters have special meaning to the shell, including:" << "\n"
|
||||||
<< " $ ! ' \" ( ) ; \\ ` * ? { } [ ] < > | & % # ~" << "\n"
|
<< " $ ! ' \" ( ) ; \\ ` * ? { } [ ] < > | & % # ~" << "\n"
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
outs = out.str();
|
outs = out.str();
|
||||||
context.hooks.trigger ("post-usage-command");
|
context.hooks.trigger ("post-usage-command");
|
||||||
|
@ -438,11 +438,11 @@ int handleInfo (std::string &outs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// dependencies: blocked
|
// dependencies: blocked
|
||||||
if (task->has ("depends"))
|
|
||||||
{
|
{
|
||||||
std::vector <Task> blocked;
|
std::vector <Task> blocked;
|
||||||
dependencyGetBlocked (*task, blocked);
|
dependencyGetBlocked (*task, blocked);
|
||||||
|
if (blocked.size ())
|
||||||
|
{
|
||||||
std::stringstream message;
|
std::stringstream message;
|
||||||
std::vector <Task>::const_iterator it;
|
std::vector <Task>::const_iterator it;
|
||||||
for (it = blocked.begin (); it != blocked.end (); ++it)
|
for (it = blocked.begin (); it != blocked.end (); ++it)
|
||||||
|
@ -452,6 +452,7 @@ int handleInfo (std::string &outs)
|
||||||
table.addCell (row, 0, "This task blocked by");
|
table.addCell (row, 0, "This task blocked by");
|
||||||
table.addCell (row, 1, message.str ());
|
table.addCell (row, 1, message.str ());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// dependencies: blocking
|
// dependencies: blocking
|
||||||
{
|
{
|
||||||
|
@ -635,11 +636,11 @@ int handleInfo (std::string &outs)
|
||||||
|
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! tasks.size ()) {
|
if (! tasks.size ()) {
|
||||||
out << "No matches." << std::endl;
|
out << "No matches.\n";
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,9 +789,9 @@ int handleReportSummary (std::string &outs)
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< table.rowCount ()
|
<< table.rowCount ()
|
||||||
<< (table.rowCount () == 1 ? " project" : " projects")
|
<< (table.rowCount () == 1 ? " project" : " projects")
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
else {
|
else {
|
||||||
out << "No projects." << std::endl;
|
out << "No projects.\n";
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -994,10 +995,10 @@ int handleReportHistoryMonthly (std::string &outs)
|
||||||
if (table.rowCount ())
|
if (table.rowCount ())
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "No tasks." << std::endl;
|
out << "No tasks.\n";
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,10 +1159,10 @@ int handleReportHistoryAnnual (std::string &outs)
|
||||||
if (table.rowCount ())
|
if (table.rowCount ())
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "No tasks." << std::endl;
|
out << "No tasks.\n";
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1352,7 +1353,7 @@ int handleReportGHistoryMonthly (std::string &outs)
|
||||||
{
|
{
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
||||||
out << "Legend: "
|
out << "Legend: "
|
||||||
|
@ -1362,13 +1363,13 @@ int handleReportGHistoryMonthly (std::string &outs)
|
||||||
<< ", "
|
<< ", "
|
||||||
<< color_delete.colorize ("deleted")
|
<< color_delete.colorize ("deleted")
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
else
|
else
|
||||||
out << "Legend: + added, X completed, - deleted" << std::endl;
|
out << "Legend: + added, X completed, - deleted\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "No tasks." << std::endl;
|
out << "No tasks.\n";
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1555,7 +1556,7 @@ int handleReportGHistoryAnnual (std::string &outs)
|
||||||
{
|
{
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
|
||||||
out << "Legend: "
|
out << "Legend: "
|
||||||
|
@ -1565,13 +1566,13 @@ int handleReportGHistoryAnnual (std::string &outs)
|
||||||
<< ", "
|
<< ", "
|
||||||
<< color_delete.colorize ("deleted")
|
<< color_delete.colorize ("deleted")
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
else
|
else
|
||||||
out << "Legend: + added, X completed, - deleted" << std::endl;
|
out << "Legend: + added, X completed, - deleted\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << "No tasks." << std::endl;
|
out << "No tasks.\n";
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1633,9 +1634,9 @@ int handleReportTimesheet (std::string &outs)
|
||||||
+ endString.toString (context.config.get ("dateformat"));
|
+ endString.toString (context.config.get ("dateformat"));
|
||||||
|
|
||||||
Color bold (Color::nocolor, Color::nocolor, false, true, false);
|
Color bold (Color::nocolor, Color::nocolor, false, true, false);
|
||||||
out << std::endl
|
out << "\n"
|
||||||
<< (color ? bold.colorize (title) : title)
|
<< (color ? bold.colorize (title) : title)
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
// Render the completed table.
|
// Render the completed table.
|
||||||
Table completed;
|
Table completed;
|
||||||
|
@ -1692,11 +1693,11 @@ int handleReportTimesheet (std::string &outs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out << " Completed (" << completed.rowCount () << " tasks)" << std::endl;
|
out << " Completed (" << completed.rowCount () << " tasks)\n";
|
||||||
|
|
||||||
if (completed.rowCount ())
|
if (completed.rowCount ())
|
||||||
out << completed.render ()
|
out << completed.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
// Now render the started table.
|
// Now render the started table.
|
||||||
Table started;
|
Table started;
|
||||||
|
@ -1753,12 +1754,11 @@ int handleReportTimesheet (std::string &outs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out << " Started (" << started.rowCount () << " tasks)" << std::endl;
|
out << " Started (" << started.rowCount () << " tasks)\n";
|
||||||
|
|
||||||
if (started.rowCount ())
|
if (started.rowCount ())
|
||||||
out << started.render ()
|
out << started.render ()
|
||||||
<< std::endl
|
<< "\n\n";
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
// Prior week.
|
// Prior week.
|
||||||
start -= 7 * 86400;
|
start -= 7 * 86400;
|
||||||
|
@ -2161,7 +2161,7 @@ int handleReportCalendar (std::string &outs)
|
||||||
int details_mFrom = mFrom;
|
int details_mFrom = mFrom;
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
out << std::endl;
|
out << "\n";
|
||||||
|
|
||||||
while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo))
|
while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo))
|
||||||
{
|
{
|
||||||
|
@ -2205,10 +2205,10 @@ int handleReportCalendar (std::string &outs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl
|
out << "\n"
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< renderMonths (mFrom, yFrom, today, tasks, monthsPerLine)
|
<< renderMonths (mFrom, yFrom, today, tasks, monthsPerLine)
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
mFrom += monthsPerLine;
|
mFrom += monthsPerLine;
|
||||||
if (mFrom > 12)
|
if (mFrom > 12)
|
||||||
|
@ -2244,7 +2244,7 @@ int handleReportCalendar (std::string &outs)
|
||||||
<< color_weeknumber.colorize ("weeknumber")
|
<< color_weeknumber.colorize ("weeknumber")
|
||||||
<< "."
|
<< "."
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
|
|
||||||
if (context.config.get ("calendar.details") == "full" || context.config.get ("calendar.holidays") == "full")
|
if (context.config.get ("calendar.details") == "full" || context.config.get ("calendar.holidays") == "full")
|
||||||
{
|
{
|
||||||
|
@ -2343,7 +2343,7 @@ int handleReportCalendar (std::string &outs)
|
||||||
|
|
||||||
out << optionalBlankLine ()
|
out << optionalBlankLine ()
|
||||||
<< holTable.render ()
|
<< holTable.render ()
|
||||||
<< std::endl;
|
<< "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue