mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI
- ::unsweetenTags no longer clobbers non-FILTER args.
This commit is contained in:
parent
cd8f7ddac4
commit
f862ad15e6
1 changed files with 25 additions and 20 deletions
45
src/CLI.cpp
45
src/CLI.cpp
|
@ -506,29 +506,34 @@ void CLI::unsweetenTags ()
|
||||||
std::vector <A>::iterator a;
|
std::vector <A>::iterator a;
|
||||||
for (a = _args.begin (); a != _args.end (); ++a)
|
for (a = _args.begin (); a != _args.end (); ++a)
|
||||||
{
|
{
|
||||||
Nibbler n (a->attribute ("raw"));
|
if (a->hasTag ("FILTER"))
|
||||||
std::string tag;
|
|
||||||
std::string sign;
|
|
||||||
|
|
||||||
if (n.getN (1, sign) &&
|
|
||||||
(sign == "+" || sign == "-") &&
|
|
||||||
n.getUntilEOS (tag) &&
|
|
||||||
tag.find (' ') == std::string::npos)
|
|
||||||
{
|
{
|
||||||
A left ("argTag", "tags");
|
Nibbler n (a->attribute ("raw"));
|
||||||
left.tag ("ATT");
|
std::string tag;
|
||||||
left.tag ("FILTER");
|
std::string sign;
|
||||||
reconstructed.push_back (left);
|
|
||||||
|
|
||||||
A op ("argTag", sign == "+" ? "_hastag_" : "_notag_");
|
if (n.getN (1, sign) &&
|
||||||
op.tag ("OP");
|
(sign == "+" || sign == "-") &&
|
||||||
op.tag ("FILTER");
|
n.getUntilEOS (tag) &&
|
||||||
reconstructed.push_back (op);
|
tag.find (' ') == std::string::npos)
|
||||||
|
{
|
||||||
|
A left ("argTag", "tags");
|
||||||
|
left.tag ("ATT");
|
||||||
|
left.tag ("FILTER");
|
||||||
|
reconstructed.push_back (left);
|
||||||
|
|
||||||
A right ("argTag", tag);
|
A op ("argTag", sign == "+" ? "_hastag_" : "_notag_");
|
||||||
right.tag ("LITERAL");
|
op.tag ("OP");
|
||||||
right.tag ("FILTER");
|
op.tag ("FILTER");
|
||||||
reconstructed.push_back (right);
|
reconstructed.push_back (op);
|
||||||
|
|
||||||
|
A right ("argTag", tag);
|
||||||
|
right.tag ("LITERAL");
|
||||||
|
right.tag ("FILTER");
|
||||||
|
reconstructed.push_back (right);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
reconstructed.push_back (*a);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
reconstructed.push_back (*a);
|
reconstructed.push_back (*a);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue