mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Code Cleanup
- Remove duplicate modify call to TDB2. - Check if quitting in bulk change only if permission fails. - Correct test logic (the unit for each operation is the second, not the day). - Consistency in test for feature.1013.t - Correctly color deleted tasks. test
This commit is contained in:
parent
39456a3243
commit
160260ff48
13 changed files with 34 additions and 35 deletions
|
@ -118,10 +118,10 @@ int CmdAnnotate::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_ANNO_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
|
|
|
@ -118,10 +118,10 @@ int CmdAppend::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_APPEND_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
|
|
|
@ -142,10 +142,10 @@ int CmdDelete::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_DELETE_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << format (STRING_CMD_DELETE_NOT_DEL,
|
||||
|
|
|
@ -131,10 +131,10 @@ int CmdDenotate::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_DENO_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << format (STRING_CMD_DENO_NOMATCH, pattern) << "\n";
|
||||
|
|
|
@ -99,7 +99,6 @@ int CmdDone::execute (std::string& output)
|
|||
++count;
|
||||
feedback_affected (STRING_CMD_DONE_TASK, *task);
|
||||
feedback_unblocked (*task);
|
||||
context.tdb2.modify (*task);
|
||||
if (!nagged)
|
||||
nagged = nag (*task);
|
||||
dependencyChainOnComplete (*task);
|
||||
|
@ -110,10 +109,10 @@ int CmdDone::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_DONE_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << format (STRING_CMD_DONE_NOTPEND,
|
||||
|
|
|
@ -124,10 +124,10 @@ int CmdDuplicate::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_DUPLICATE_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
|
|
|
@ -161,11 +161,11 @@ int CmdModify::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_MODIFY_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
|
|
|
@ -118,10 +118,10 @@ int CmdPrepend::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_PREPEND_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
|
|
|
@ -103,10 +103,10 @@ int CmdStart::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_START_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << format (STRING_CMD_START_ALREADY,
|
||||
|
|
|
@ -99,10 +99,10 @@ int CmdStop::execute (std::string& output)
|
|||
{
|
||||
std::cout << STRING_CMD_STOP_NO << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
if (_permission_quit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << format (STRING_CMD_STOP_ALREADY,
|
||||
|
|
|
@ -273,7 +273,7 @@ static void colorizeCompleted (Task& task, const Color& base, Color& c)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void colorizeDeleted (Task& task, const Color& base, Color& c)
|
||||
{
|
||||
if (task.getStatus () == Task::completed)
|
||||
if (task.getStatus () == Task::deleted)
|
||||
c.blend (base);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ int main (int argc, char** argv)
|
|||
{
|
||||
Date now;
|
||||
Date yesterday;
|
||||
yesterday -= 1;
|
||||
yesterday -= 86400;
|
||||
|
||||
t.ok (yesterday <= now, "yesterday <= now");
|
||||
t.ok (yesterday < now, "yesterday < now");
|
||||
|
@ -140,7 +140,7 @@ int main (int argc, char** argv)
|
|||
t.is (happyNewYear.day (), 1, "1/1/2008 == 1");
|
||||
t.is (happyNewYear.year (), 2008, "1/1/2008 == 2008");
|
||||
|
||||
t.is (now - yesterday, 1, "today - yesterday == 1");
|
||||
t.is (now - yesterday, 86400, "today - yesterday == 1");
|
||||
|
||||
t.is (happyNewYear.toString (), "1/1/2008", "toString 1/1/2008");
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ like ($stderr, qr/^Configuration override rc.debug:on$/ms, 'Footnotes are sent t
|
|||
|
||||
# Check that debugs are sent to standard error
|
||||
$stdout = qx{../src/task rc:outerr.rc rc.debug:on list 2> /dev/null};
|
||||
unlike ($stdout, qr/^Perf task /ms, 'Debugs are not sent to stdout');
|
||||
unlike ($stdout, qr/^Timer Config::load \(outerr.rc\) /ms, 'Debugs are not sent to stdout');
|
||||
$stderr = qx{../src/task rc:outerr.rc rc.debug:on list 2>&1 >/dev/null};
|
||||
like ($stderr, qr/^Timer Config::load \(outerr.rc\) /ms, 'Debugs are sent to stderr');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue