mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
CLI2: Simplified logic for separating FILTER, MODIFICATION, MISCELLANEOUS args
This commit is contained in:
parent
62a66bad9c
commit
274d3dddd0
1 changed files with 11 additions and 13 deletions
20
src/CLI2.cpp
20
src/CLI2.cpp
|
@ -628,7 +628,7 @@ void CLI2::prepareFilter ()
|
||||||
|
|
||||||
// Classify FILTER, MODIFICATION and MISCELLANEOUS args, based on CMD DNA.
|
// Classify FILTER, MODIFICATION and MISCELLANEOUS args, based on CMD DNA.
|
||||||
bool changes = false;
|
bool changes = false;
|
||||||
bool foundCommand = false;
|
bool afterCommand = false;
|
||||||
|
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
|
@ -637,7 +637,7 @@ void CLI2::prepareFilter ()
|
||||||
|
|
||||||
if (a.hasTag ("CMD"))
|
if (a.hasTag ("CMD"))
|
||||||
{
|
{
|
||||||
foundCommand = true;
|
afterCommand = true;
|
||||||
}
|
}
|
||||||
else if (a.hasTag ("BINARY") ||
|
else if (a.hasTag ("BINARY") ||
|
||||||
a.hasTag ("RC") ||
|
a.hasTag ("RC") ||
|
||||||
|
@ -649,19 +649,18 @@ void CLI2::prepareFilter ()
|
||||||
// All MODIFICATION args appear after the command.
|
// All MODIFICATION args appear after the command.
|
||||||
else if (cmd &&
|
else if (cmd &&
|
||||||
cmd->accepts_modifications () &&
|
cmd->accepts_modifications () &&
|
||||||
foundCommand)
|
! cmd->accepts_miscellaneous () &&
|
||||||
|
afterCommand)
|
||||||
{
|
{
|
||||||
a.tag ("MODIFICATION");
|
a.tag ("MODIFICATION");
|
||||||
changes = true;
|
changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// All MISCELLANEOUS args appear after the command.
|
|
||||||
else if (cmd &&
|
else if (cmd &&
|
||||||
cmd->accepts_miscellaneous () &&
|
cmd->accepts_miscellaneous () &&
|
||||||
! cmd->accepts_modifications () &&
|
! cmd->accepts_modifications () &&
|
||||||
(foundCommand ||
|
(afterCommand ||
|
||||||
(! foundCommand &&
|
! cmd->accepts_filter ()))
|
||||||
! cmd->accepts_filter ())))
|
|
||||||
{
|
{
|
||||||
a.tag ("MISCELLANEOUS");
|
a.tag ("MISCELLANEOUS");
|
||||||
changes = true;
|
changes = true;
|
||||||
|
@ -669,10 +668,9 @@ void CLI2::prepareFilter ()
|
||||||
|
|
||||||
else if (cmd &&
|
else if (cmd &&
|
||||||
cmd->accepts_filter () &&
|
cmd->accepts_filter () &&
|
||||||
(! foundCommand ||
|
(! afterCommand ||
|
||||||
(foundCommand &&
|
(! cmd->accepts_modifications () &&
|
||||||
(! cmd->accepts_modifications () ||
|
! cmd->accepts_miscellaneous ())))
|
||||||
! cmd->accepts_miscellaneous ()))))
|
|
||||||
{
|
{
|
||||||
a.tag ("FILTER");
|
a.tag ("FILTER");
|
||||||
changes = true;
|
changes = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue