mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug #433 - Missing punctuation in some command output
- Made punctuation consistent throughout the code and addressed a few broken tests.
This commit is contained in:
parent
c43eb31374
commit
d6a2c1872c
19 changed files with 81 additions and 78 deletions
|
@ -12,6 +12,7 @@
|
||||||
+ Improved man pages (thanks to Andy Lester).
|
+ Improved man pages (thanks to Andy Lester).
|
||||||
+ Default .taskrc files are now largely empty, and rely almost completed
|
+ Default .taskrc files are now largely empty, and rely almost completed
|
||||||
on default values.
|
on default values.
|
||||||
|
+ Fixed bug #433, making task command output more consistent.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
20
src/API.cpp
20
src/API.cpp
|
@ -612,14 +612,14 @@ bool API::callProgramHook (
|
||||||
|
|
||||||
// Make call.
|
// Make call.
|
||||||
if (lua_pcall (L, 0, 2, 0) != 0)
|
if (lua_pcall (L, 0, 2, 0) != 0)
|
||||||
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1);
|
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1) + ".";
|
||||||
|
|
||||||
// Call successful - get return values.
|
// Call successful - get return values.
|
||||||
if (!lua_isnumber (L, -2))
|
if (!lua_isnumber (L, -2))
|
||||||
throw std::string ("Error: '") + function + "' did not return a success indicator";
|
throw std::string ("Error: '") + function + "' did not return a success indicator.";
|
||||||
|
|
||||||
if (!lua_isstring (L, -1) && !lua_isnil (L, -1))
|
if (!lua_isstring (L, -1) && !lua_isnil (L, -1))
|
||||||
throw std::string ("Error: '") + function + "' did not return a message or nil";
|
throw std::string ("Error: '") + function + "' did not return a message or nil.";
|
||||||
|
|
||||||
int rc = lua_tointeger (L, -2);
|
int rc = lua_tointeger (L, -2);
|
||||||
const char* message = lua_tostring (L, -1);
|
const char* message = lua_tostring (L, -1);
|
||||||
|
@ -684,17 +684,17 @@ bool API::callTaskHook (
|
||||||
|
|
||||||
// Make call.
|
// Make call.
|
||||||
if (lua_pcall (L, 1, 2, 0) != 0)
|
if (lua_pcall (L, 1, 2, 0) != 0)
|
||||||
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1);
|
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1) + ".";
|
||||||
|
|
||||||
// Hide the task.
|
// Hide the task.
|
||||||
the_task = NULL;
|
the_task = NULL;
|
||||||
|
|
||||||
// Call successful - get return values.
|
// Call successful - get return values.
|
||||||
if (!lua_isnumber (L, -2))
|
if (!lua_isnumber (L, -2))
|
||||||
throw std::string ("Error: '") + function + "' did not return a success indicator";
|
throw std::string ("Error: '") + function + "' did not return a success indicator.";
|
||||||
|
|
||||||
if (!lua_isstring (L, -1) && !lua_isnil (L, -1))
|
if (!lua_isstring (L, -1) && !lua_isnil (L, -1))
|
||||||
throw std::string ("Error: '") + function + "' did not return a message or nil";
|
throw std::string ("Error: '") + function + "' did not return a message or nil.";
|
||||||
|
|
||||||
int rc = lua_tointeger (L, -2);
|
int rc = lua_tointeger (L, -2);
|
||||||
const char* message = lua_tostring (L, -1);
|
const char* message = lua_tostring (L, -1);
|
||||||
|
@ -737,17 +737,17 @@ bool API::callFieldHook (
|
||||||
|
|
||||||
// Make call.
|
// Make call.
|
||||||
if (lua_pcall (L, 2, 3, 0) != 0)
|
if (lua_pcall (L, 2, 3, 0) != 0)
|
||||||
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1);
|
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1) + ".";
|
||||||
|
|
||||||
// Call successful - get return values.
|
// Call successful - get return values.
|
||||||
if (!lua_isstring (L, -3))
|
if (!lua_isstring (L, -3))
|
||||||
throw std::string ("Error: '") + function + "' did not return a modified value";
|
throw std::string ("Error: '") + function + "' did not return a modified value.";
|
||||||
|
|
||||||
if (!lua_isnumber (L, -2))
|
if (!lua_isnumber (L, -2))
|
||||||
throw std::string ("Error: '") + function + "' did not return a success indicator";
|
throw std::string ("Error: '") + function + "' did not return a success indicator.";
|
||||||
|
|
||||||
if (!lua_isstring (L, -1) && !lua_isnil (L, -1))
|
if (!lua_isstring (L, -1) && !lua_isnil (L, -1))
|
||||||
throw std::string ("Error: '") + function + "' did not return a message or nil";
|
throw std::string ("Error: '") + function + "' did not return a message or nil.";
|
||||||
|
|
||||||
const char* new_value = lua_tostring (L, -3);
|
const char* new_value = lua_tostring (L, -3);
|
||||||
int rc = lua_tointeger (L, -2);
|
int rc = lua_tointeger (L, -2);
|
||||||
|
|
16
src/Att.cpp
16
src/Att.cpp
|
@ -256,7 +256,7 @@ bool Att::validNameValue (
|
||||||
std::string combined;
|
std::string combined;
|
||||||
join (combined, ", ", matches);
|
join (combined, ", ", matches);
|
||||||
|
|
||||||
throw error + combined;
|
throw error + combined + ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
name = matches[0];
|
name = matches[0];
|
||||||
|
@ -272,7 +272,7 @@ bool Att::validNameValue (
|
||||||
autoComplete (mod, candidates, matches);
|
autoComplete (mod, candidates, matches);
|
||||||
|
|
||||||
if (matches.size () == 0)
|
if (matches.size () == 0)
|
||||||
throw std::string ("Unrecognized modifier '") + mod + "'";
|
throw std::string ("Unrecognized modifier '") + mod + "'.";
|
||||||
|
|
||||||
else if (matches.size () != 1)
|
else if (matches.size () != 1)
|
||||||
{
|
{
|
||||||
|
@ -282,7 +282,7 @@ bool Att::validNameValue (
|
||||||
join (combined, ", ", matches);
|
join (combined, ", ", matches);
|
||||||
error += combined;
|
error += combined;
|
||||||
|
|
||||||
throw error + combined;
|
throw error + combined + ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
mod = matches[0];
|
mod = matches[0];
|
||||||
|
@ -467,10 +467,10 @@ void Att::parse (Nibbler& n)
|
||||||
if (validMod (mod))
|
if (validMod (mod))
|
||||||
mMod = mod;
|
mMod = mod;
|
||||||
else
|
else
|
||||||
throw std::string ("The name '") + mod + "' is not a valid modifier"; // TODO i18n
|
throw std::string ("The name '") + mod + "' is not a valid modifier."; // TODO i18n
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Missing . or : after modifier"); // TODO i18n
|
throw std::string ("Missing . or : after modifier."); // TODO i18n
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n.skip (':'))
|
if (n.skip (':'))
|
||||||
|
@ -484,10 +484,10 @@ void Att::parse (Nibbler& n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Missing : after attribute name"); // TODO i18n
|
throw std::string ("Missing : after attribute name."); // TODO i18n
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Missing : after attribute name"); // TODO i18n
|
throw std::string ("Missing : after attribute name."); // TODO i18n
|
||||||
|
|
||||||
/* TODO This might be too slow to include. Test this assumption.
|
/* TODO This might be too slow to include. Test this assumption.
|
||||||
validNameValue (mName, mMod, mValue);
|
validNameValue (mName, mMod, mValue);
|
||||||
|
@ -719,7 +719,7 @@ std::string Att::composeF4 () const
|
||||||
void Att::mod (const std::string& input)
|
void Att::mod (const std::string& input)
|
||||||
{
|
{
|
||||||
if (input != "" && !validMod (input))
|
if (input != "" && !validMod (input))
|
||||||
throw std::string ("The name '") + input + "' is not a valid modifier"; // TODO i18n
|
throw std::string ("The name '") + input + "' is not a valid modifier."; // TODO i18n
|
||||||
|
|
||||||
mMod = input;
|
mMod = input;
|
||||||
}
|
}
|
||||||
|
|
|
@ -457,13 +457,13 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
|
||||||
if (included.readable ())
|
if (included.readable ())
|
||||||
this->load (included, nest + 1);
|
this->load (included, nest + 1);
|
||||||
else
|
else
|
||||||
throw std::string ("Could not read include file '") + included.data + "'";
|
throw std::string ("Could not read include file '") + included.data + "'.";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Can only include files with absolute paths, not '") + included.data + "'";
|
throw std::string ("Can only include files with absolute paths, not '") + included.data + "'";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Malformed entry '") + line + "'";
|
throw std::string ("Malformed entry '") + line + "'.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
|
||||||
|
|
||||||
// Write out the new file.
|
// Write out the new file.
|
||||||
if (! File::write (rc, contents.str ()))
|
if (! File::write (rc, contents.str ()))
|
||||||
throw std::string ("Could not write to '") + rc + "'";
|
throw std::string ("Could not write to '") + rc + "'.";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -321,7 +321,7 @@ void Context::shadow ()
|
||||||
|
|
||||||
// Optionally display a notification that the shadow file was updated.
|
// Optionally display a notification that the shadow file was updated.
|
||||||
if (config.getBoolean ("shadow.notify"))
|
if (config.getBoolean ("shadow.notify"))
|
||||||
footnote (std::string ("[Shadow file '") + shadowFile.data + "' updated]");
|
footnote (std::string ("[Shadow file '") + shadowFile.data + "' updated.]");
|
||||||
|
|
||||||
inShadow = false;
|
inShadow = false;
|
||||||
}
|
}
|
||||||
|
@ -751,7 +751,7 @@ void Context::parse (
|
||||||
else
|
else
|
||||||
throw stringtable.get (
|
throw stringtable.get (
|
||||||
CMD_MISSING,
|
CMD_MISSING,
|
||||||
"You must specify a command, or a task ID to modify");
|
"You must specify a command, or a task ID to modify.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the command "task 123" is entered, but with no modifier arguments,
|
// If the command "task 123" is entered, but with no modifier arguments,
|
||||||
|
|
|
@ -132,7 +132,7 @@ void Filter::applySequence (std::vector<Task>& all, Sequence& sequence)
|
||||||
std::vector <int> right;
|
std::vector <int> right;
|
||||||
listDiff (filteredSequence, (std::vector <int>&)sequence, left, right);
|
listDiff (filteredSequence, (std::vector <int>&)sequence, left, right);
|
||||||
if (left.size ())
|
if (left.size ())
|
||||||
throw std::string ("Sequence filtering error - please report this error to support@taskwarrior.org");
|
throw std::string ("Sequence filtering error - please report this error to support@taskwarrior.org.");
|
||||||
|
|
||||||
if (right.size ())
|
if (right.size ())
|
||||||
{
|
{
|
||||||
|
|
|
@ -303,7 +303,7 @@ void Hooks::initialize ()
|
||||||
(void) n.skip (',');
|
(void) n.skip (',');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Malformed hook definition '") + *it + "'";
|
throw std::string ("Malformed hook definition '") + *it + "'.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ bool Hooks::trigger (const std::string& event)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Unrecognized hook event '") + event + "'";
|
throw std::string ("Unrecognized hook event '") + event + "'.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -358,7 +358,7 @@ bool Hooks::trigger (const std::string& event, std::vector <Task>& tasks)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Unrecognized hook event '") + event + "'";
|
throw std::string ("Unrecognized hook event '") + event + "'.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -385,7 +385,7 @@ bool Hooks::trigger (const std::string& event, Task& task)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Unrecognized hook event '") + event + "'";
|
throw std::string ("Unrecognized hook event '") + event + "'.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -415,7 +415,7 @@ bool Hooks::trigger (
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Unrecognized hook event '") + event + "'";
|
throw std::string ("Unrecognized hook event '") + event + "'.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -95,7 +95,7 @@ void Record::parse (const std::string& input)
|
||||||
{
|
{
|
||||||
if (line.length () == 0)
|
if (line.length () == 0)
|
||||||
throw context.stringtable.get (RECORD_EMPTY,
|
throw context.stringtable.get (RECORD_EMPTY,
|
||||||
"Empty record in input");
|
"Empty record in input.");
|
||||||
|
|
||||||
Nibbler nl (line);
|
Nibbler nl (line);
|
||||||
Att a;
|
Att a;
|
||||||
|
@ -110,11 +110,11 @@ void Record::parse (const std::string& input)
|
||||||
nl.getUntilEOS (remainder);
|
nl.getUntilEOS (remainder);
|
||||||
if (remainder.length ())
|
if (remainder.length ())
|
||||||
throw context.stringtable.get (RECORD_EXTRA,
|
throw context.stringtable.get (RECORD_EXTRA,
|
||||||
"Unrecognized characters at end of line");
|
"Unrecognized characters at end of line.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw context.stringtable.get (RECORD_NOT_FF4,
|
throw context.stringtable.get (RECORD_NOT_FF4,
|
||||||
"Record not recognized as format 4");
|
"Record not recognized as format 4.");
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -96,7 +96,7 @@ void Sequence::parse (const std::string& input)
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (! validId (range[0]))
|
if (! validId (range[0]))
|
||||||
throw context.stringtable.get (SEQUENCE_BAD_SEQ, "Invalid ID in sequence");
|
throw context.stringtable.get (SEQUENCE_BAD_SEQ, "Invalid ID in sequence.");
|
||||||
|
|
||||||
int id = atoi (range[0].c_str ());
|
int id = atoi (range[0].c_str ());
|
||||||
this->push_back (id);
|
this->push_back (id);
|
||||||
|
@ -107,15 +107,15 @@ void Sequence::parse (const std::string& input)
|
||||||
{
|
{
|
||||||
if (! validId (range[0]) ||
|
if (! validId (range[0]) ||
|
||||||
! validId (range[1]))
|
! validId (range[1]))
|
||||||
throw context.stringtable.get (SEQUENCE_BAD_SEQ, "Invalid ID in range");
|
throw context.stringtable.get (SEQUENCE_BAD_SEQ, "Invalid ID in range.");
|
||||||
|
|
||||||
int low = atoi (range[0].c_str ());
|
int low = atoi (range[0].c_str ());
|
||||||
int high = atoi (range[1].c_str ());
|
int high = atoi (range[1].c_str ());
|
||||||
if (low > high)
|
if (low > high)
|
||||||
throw context.stringtable.get (SEQUENCE_INVERTED, "Inverted sequence range high-low");
|
throw context.stringtable.get (SEQUENCE_INVERTED, "Inverted sequence range high-low.");
|
||||||
|
|
||||||
if (high - low >= SEQUENCE_MAX)
|
if (high - low >= SEQUENCE_MAX)
|
||||||
throw context.stringtable.get (SEQUENCE_RANGE_MAX, "ID Range too large");
|
throw context.stringtable.get (SEQUENCE_RANGE_MAX, "ID Range too large.");
|
||||||
|
|
||||||
for (int i = low; i <= high; ++i)
|
for (int i = low; i <= high; ++i)
|
||||||
this->push_back (i);
|
this->push_back (i);
|
||||||
|
|
|
@ -105,15 +105,15 @@ void Subst::parse (const std::string& input)
|
||||||
|
|
||||||
if (mFrom == "")
|
if (mFrom == "")
|
||||||
throw context.stringtable.get (SUBST_EMPTY,
|
throw context.stringtable.get (SUBST_EMPTY,
|
||||||
"Cannot substitute an empty string");
|
"Cannot substitute an empty string.");
|
||||||
|
|
||||||
if (!n.depleted ())
|
if (!n.depleted ())
|
||||||
throw context.stringtable.get (SUBST_BAD_CHARS,
|
throw context.stringtable.get (SUBST_BAD_CHARS,
|
||||||
"Unrecognized character(s) at end of substitution");
|
"Unrecognized character(s) at end of substitution.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw context.stringtable.get (SUBST_MALFORMED,
|
throw context.stringtable.get (SUBST_MALFORMED,
|
||||||
"Malformed substitution");
|
"Malformed substitution.");
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -83,7 +83,7 @@ void readTaskmods (std::vector <std::string> &input,
|
||||||
stream >> ts;
|
stream >> ts;
|
||||||
|
|
||||||
if (stream.fail()) {
|
if (stream.fail()) {
|
||||||
throw std::string ("Failed to convert \"" + stream.str() + "\" to integer: " + tmod_tmp.getTimeStr());
|
throw std::string ("Failed to convert \"" + stream.str() + "\" to integer: " + tmod_tmp.getTimeStr() + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'time' is the first line of a modification
|
// 'time' is the first line of a modification
|
||||||
|
@ -1452,7 +1452,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." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete objects
|
// delete objects
|
||||||
|
|
|
@ -117,7 +117,7 @@ bool Taskmod::isValid()
|
||||||
std::string Taskmod::getUuid()
|
std::string Taskmod::getUuid()
|
||||||
{
|
{
|
||||||
if (!bAfterSet) {
|
if (!bAfterSet) {
|
||||||
throw std::string("Taskmod::getUuid(): Task object not initialized");
|
throw std::string("Taskmod::getUuid(): Task object not initialized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return after.get("uuid");
|
return after.get("uuid");
|
||||||
|
|
|
@ -133,7 +133,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 () << "." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
context.tdb.commit ();
|
context.tdb.commit ();
|
||||||
|
@ -715,7 +715,7 @@ int handleShow (std::string &outs)
|
||||||
std::vector <std::string> unrecognized;
|
std::vector <std::string> unrecognized;
|
||||||
foreach (i, all)
|
foreach (i, all)
|
||||||
{
|
{
|
||||||
// Disallow partial matches by tacking a leading an trailing space on each
|
// Disallow partial matches by tacking a leading and trailing space on each
|
||||||
// variable name.
|
// variable name.
|
||||||
std::string pattern = " " + *i + " ";
|
std::string pattern = " " + *i + " ";
|
||||||
if (recognized.find (pattern) == std::string::npos)
|
if (recognized.find (pattern) == std::string::npos)
|
||||||
|
@ -786,7 +786,7 @@ int handleShow (std::string &outs)
|
||||||
|
|
||||||
out << std::endl
|
out << std::endl
|
||||||
<< table.render ()
|
<< table.render ()
|
||||||
<< (table.rowCount () == 0 ? "No matching configuration variables\n" : "")
|
<< (table.rowCount () == 0 ? "No matching configuration variables.\n" : "")
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
// Display the unrecognized variables.
|
// Display the unrecognized variables.
|
||||||
|
@ -897,7 +897,7 @@ int handleShow (std::string &outs)
|
||||||
|
|
||||||
if (all.size () == 0)
|
if (all.size () == 0)
|
||||||
{
|
{
|
||||||
out << "Configuration error: .taskrc contains no entries"
|
out << "Configuration error: .taskrc contains no entries."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
@ -975,7 +975,7 @@ int handleConfig (std::string &outs)
|
||||||
{
|
{
|
||||||
std::string::size_type eol = contents.find_first_of ("\r\f\n", pos);
|
std::string::size_type eol = contents.find_first_of ("\r\f\n", pos);
|
||||||
if (eol == std::string::npos)
|
if (eol == std::string::npos)
|
||||||
throw std::string ("Cannot find EOL after entry '") + name + "'";
|
throw std::string ("Cannot find EOL after entry '") + name + "'.";
|
||||||
|
|
||||||
if (confirm (std::string ("Are you sure you want to change the value of '")
|
if (confirm (std::string ("Are you sure you want to change the value of '")
|
||||||
+ name
|
+ name
|
||||||
|
@ -1011,11 +1011,11 @@ int handleConfig (std::string &outs)
|
||||||
// Remove name
|
// Remove name
|
||||||
std::string::size_type pos = contents.find (name + "=");
|
std::string::size_type pos = contents.find (name + "=");
|
||||||
if (pos == std::string::npos)
|
if (pos == std::string::npos)
|
||||||
throw std::string ("No entry named '") + name + "' found";
|
throw std::string ("No entry named '") + name + "' found.";
|
||||||
|
|
||||||
std::string::size_type eol = contents.find_first_of ("\r\f\n", pos);
|
std::string::size_type eol = contents.find_first_of ("\r\f\n", pos);
|
||||||
if (eol == std::string::npos)
|
if (eol == std::string::npos)
|
||||||
throw std::string ("Cannot find EOL after entry '") + name + "'";
|
throw std::string ("Cannot find EOL after entry '") + name + "'.";
|
||||||
|
|
||||||
if (confirm (std::string ("Are you sure you want to remove '") + name + "'?"))
|
if (confirm (std::string ("Are you sure you want to remove '") + name + "'?"))
|
||||||
{
|
{
|
||||||
|
@ -1112,7 +1112,7 @@ int handleDelete (std::string &outs)
|
||||||
<< sibling->id
|
<< sibling->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< sibling->get ("description")
|
<< sibling->get ("description")
|
||||||
<< "'"
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1134,7 +1134,7 @@ int handleDelete (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'"
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1154,7 +1154,7 @@ int handleDelete (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'"
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1212,7 +1212,7 @@ int handleStart (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'"
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
if (!nagged)
|
if (!nagged)
|
||||||
nagged = nag (*task);
|
nagged = nag (*task);
|
||||||
|
@ -1270,7 +1270,7 @@ int handleStop (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'"
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1354,7 +1354,7 @@ int handleDone (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'"
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
@ -1374,7 +1374,7 @@ int handleDone (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "' is not pending"
|
<< "' is not pending."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
@ -1389,7 +1389,7 @@ int handleDone (std::string &outs)
|
||||||
<< count
|
<< count
|
||||||
<< " task"
|
<< " task"
|
||||||
<< (count == 1 ? "" : "s")
|
<< (count == 1 ? "" : "s")
|
||||||
<< " as done"
|
<< " as done."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
|
@ -1504,7 +1504,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 ? "." : "s.") << std::endl;
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1563,6 +1563,7 @@ int handleAppend (std::string &outs)
|
||||||
<< context.task.get ("description")
|
<< context.task.get ("description")
|
||||||
<< "' to task "
|
<< "' to task "
|
||||||
<< other->id
|
<< other->id
|
||||||
|
<< "."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
@ -1576,7 +1577,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 ? "." : "s.") << std::endl;
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
context.hooks.trigger ("post-append-command");
|
context.hooks.trigger ("post-append-command");
|
||||||
|
@ -1638,6 +1639,7 @@ int handlePrepend (std::string &outs)
|
||||||
<< context.task.get ("description")
|
<< context.task.get ("description")
|
||||||
<< "' to task "
|
<< "' to task "
|
||||||
<< other->id
|
<< other->id
|
||||||
|
<< "."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
@ -1651,7 +1653,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 ? "." : "s.") << std::endl;
|
||||||
|
|
||||||
outs = out.str ();
|
outs = out.str ();
|
||||||
context.hooks.trigger ("post-prepend-command");
|
context.hooks.trigger ("post-prepend-command");
|
||||||
|
@ -1719,20 +1721,20 @@ int handleDuplicate (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " '"
|
<< " '"
|
||||||
<< task->get ("description")
|
<< task->get ("description")
|
||||||
<< "'"
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ? "." : "s.") << std::endl;
|
||||||
#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 () << "." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1995,7 +1997,7 @@ int handleColor (std::string &outs)
|
||||||
|
|
||||||
out << std::endl
|
out << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< "Try running 'task color white on red'"
|
<< "Try running 'task color white on red'."
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
@ -2058,7 +2060,7 @@ int handleAnnotate (std::string &outs)
|
||||||
<< task->id
|
<< task->id
|
||||||
<< " with '"
|
<< " with '"
|
||||||
<< context.task.get ("description")
|
<< context.task.get ("description")
|
||||||
<< "'"
|
<< "'."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -778,7 +778,7 @@ void validReportColumns (const std::vector <std::string>& columns)
|
||||||
{
|
{
|
||||||
std::string error;
|
std::string error;
|
||||||
join (error, ", ", bad);
|
join (error, ", ", bad);
|
||||||
throw std::string ("Unrecognized column name: ") + error;
|
throw std::string ("Unrecognized column name: ") + error + ".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -804,7 +804,7 @@ void validSortColumns (
|
||||||
{
|
{
|
||||||
std::string error;
|
std::string error;
|
||||||
join (error, ", ", bad);
|
join (error, ", ", bad);
|
||||||
throw std::string ("Sort column is not part of the report: ") + error;
|
throw std::string ("Sort column is not part of the report: ") + error + ".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,7 @@ static void parseTask (Task& task, const std::string& after)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::string ("Cannot remove creation date");
|
throw std::string ("Cannot remove creation date.");
|
||||||
|
|
||||||
// start
|
// start
|
||||||
value = findDate (after, "Started:");
|
value = findDate (after, "Started:");
|
||||||
|
|
|
@ -75,7 +75,7 @@ void handleRecurrence ()
|
||||||
<< t->get ("uuid")
|
<< t->get ("uuid")
|
||||||
<< " ("
|
<< " ("
|
||||||
<< trim (t->get ("description"))
|
<< trim (t->get ("description"))
|
||||||
<< ") is past its 'until' date, and has been deleted"
|
<< ") has past its 'until' date, and has been deleted."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
// Determine the end date.
|
// Determine the end date.
|
||||||
|
|
|
@ -44,7 +44,7 @@ if (open my $fh, '>', 'custom.rc')
|
||||||
|
|
||||||
# Generate the usage screen, and locate the custom report on it.
|
# Generate the usage screen, and locate the custom report on it.
|
||||||
my $output = qx{../task rc:custom.rc foo 2>&1};
|
my $output = qx{../task rc:custom.rc foo 2>&1};
|
||||||
like ($output, qr/Unrecognized column name: foo\n/, 'custom report spotted invalid column');
|
like ($output, qr/Unrecognized column name: foo\.\n/, 'custom report spotted invalid column');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink 'pending.data';
|
||||||
|
|
|
@ -43,16 +43,16 @@ if (open my $fh, '>', 'shadow.rc')
|
||||||
}
|
}
|
||||||
|
|
||||||
my $output = qx{../task rc:shadow.rc add one};
|
my $output = qx{../task rc:shadow.rc add one};
|
||||||
like ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\]/, 'shadow file updated on add');
|
like ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\.\]/, 'shadow file updated on add');
|
||||||
|
|
||||||
$output = qx{../task rc:shadow.rc list};
|
$output = qx{../task rc:shadow.rc list};
|
||||||
unlike ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\]/, 'shadow file not updated on list');
|
unlike ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\.\]/, 'shadow file not updated on list');
|
||||||
|
|
||||||
$output = qx{../task rc:shadow.rc delete 1};
|
$output = qx{../task rc:shadow.rc delete 1};
|
||||||
like ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\]/, 'shadow file updated on delete');
|
like ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\.\]/, 'shadow file updated on delete');
|
||||||
|
|
||||||
$output = qx{../task rc:shadow.rc list};
|
$output = qx{../task rc:shadow.rc list};
|
||||||
unlike ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\]/, 'shadow file not updated on list');
|
unlike ($output, qr/\[Shadow file '\.\/shadow\.txt' updated\.\]/, 'shadow file not updated on list');
|
||||||
|
|
||||||
# Inspect the shadow file.
|
# Inspect the shadow file.
|
||||||
my $file = slurp ('./shadow.txt');
|
my $file = slurp ('./shadow.txt');
|
||||||
|
|
|
@ -368,14 +368,14 @@ std::string taskDifferences (const Task& before, const Task& after)
|
||||||
foreach (name, beforeOnly)
|
foreach (name, beforeOnly)
|
||||||
out << " - "
|
out << " - "
|
||||||
<< *name
|
<< *name
|
||||||
<< " will be deleted\n";
|
<< " will be deleted.\n";
|
||||||
|
|
||||||
foreach (name, afterOnly)
|
foreach (name, afterOnly)
|
||||||
out << " - "
|
out << " - "
|
||||||
<< *name
|
<< *name
|
||||||
<< " will be set to '"
|
<< " will be set to '"
|
||||||
<< renderAttribute (*name, after.get (*name))
|
<< renderAttribute (*name, after.get (*name))
|
||||||
<< "'\n";
|
<< "'.\n";
|
||||||
|
|
||||||
foreach (name, beforeAtts)
|
foreach (name, beforeAtts)
|
||||||
if (*name != "uuid" &&
|
if (*name != "uuid" &&
|
||||||
|
@ -386,11 +386,11 @@ std::string taskDifferences (const Task& before, const Task& after)
|
||||||
<< renderAttribute (*name, before.get (*name))
|
<< renderAttribute (*name, before.get (*name))
|
||||||
<< "' to '"
|
<< "' to '"
|
||||||
<< renderAttribute (*name, after.get (*name))
|
<< renderAttribute (*name, after.get (*name))
|
||||||
<< "'\n";
|
<< "'.\n";
|
||||||
|
|
||||||
// Shouldn't just say nothing.
|
// Shouldn't just say nothing.
|
||||||
if (out.str ().length () == 0)
|
if (out.str ().length () == 0)
|
||||||
out << " - No changes will be made\n";
|
out << " - No changes will be made.\n";
|
||||||
|
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue