mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-01 18:27:20 +02:00
Filter: Corrected implementation of ::safety
This commit is contained in:
parent
e0291d35e4
commit
358223a6b1
2 changed files with 11 additions and 14 deletions
|
@ -182,7 +182,7 @@ void Filter::subset (std::vector <Task>& output, bool applyContext /* = true */)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
safety (precompiled.size ());
|
safety ();
|
||||||
context.timer_filter.stop ();
|
context.timer_filter.stop ();
|
||||||
|
|
||||||
for (auto& task : context.tdb2.pending.get_tasks ())
|
for (auto& task : context.tdb2.pending.get_tasks ())
|
||||||
|
@ -261,15 +261,13 @@ bool Filter::pendingOnly ()
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Disaster avoidance mechanism. If a WRITECMD has no filter, then it can cause
|
// Disaster avoidance mechanism. If a WRITECMD has no filter, then it can cause
|
||||||
// all tasks to be modified. This is usually not intended.
|
// all tasks to be modified. This is usually not intended.
|
||||||
void Filter::safety (unsigned int terms)
|
void Filter::safety ()
|
||||||
{
|
{
|
||||||
for (auto& a : context.cli2._args)
|
for (auto& a : context.cli2._args)
|
||||||
{
|
{
|
||||||
if (a.hasTag ("CMD"))
|
if (a.hasTag ("CMD"))
|
||||||
{
|
{
|
||||||
if (a.hasTag ("WRITECMD"))
|
if (a.hasTag ("WRITECMD"))
|
||||||
{
|
|
||||||
if (terms)
|
|
||||||
{
|
{
|
||||||
if (! context.config.getBoolean ("allow.empty.filter"))
|
if (! context.config.getBoolean ("allow.empty.filter"))
|
||||||
throw std::string (STRING_TASK_SAFETY_ALLOW);
|
throw std::string (STRING_TASK_SAFETY_ALLOW);
|
||||||
|
@ -282,7 +280,6 @@ void Filter::safety (unsigned int terms)
|
||||||
// Sounds the alarm.
|
// Sounds the alarm.
|
||||||
throw std::string (STRING_TASK_SAFETY_FAIL);
|
throw std::string (STRING_TASK_SAFETY_FAIL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// CMD was found.
|
// CMD was found.
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
void subset (const std::vector <Task>&, std::vector <Task>&, bool applyContext = true);
|
void subset (const std::vector <Task>&, std::vector <Task>&, bool applyContext = true);
|
||||||
void subset (std::vector <Task>&, bool applyContext = true);
|
void subset (std::vector <Task>&, bool applyContext = true);
|
||||||
bool pendingOnly ();
|
bool pendingOnly ();
|
||||||
void safety (unsigned int);
|
void safety ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _startCount;
|
int _startCount;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue