mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-30 02:17:21 +02:00
CLI
- An arg preceded by an OP is not a plain arg.
This commit is contained in:
parent
47e8ae6c02
commit
286c378180
1 changed files with 7 additions and 2 deletions
|
@ -265,7 +265,6 @@ void CLI::initialize (int argc, const char** argv)
|
||||||
// Capture a single argument, and recalc everything.
|
// Capture a single argument, and recalc everything.
|
||||||
void CLI::add (const std::string& arg)
|
void CLI::add (const std::string& arg)
|
||||||
{
|
{
|
||||||
// Clean what needs to be cleaned. Most in this case.
|
|
||||||
_original_args.push_back (arg);
|
_original_args.push_back (arg);
|
||||||
|
|
||||||
analyze ();
|
analyze ();
|
||||||
|
@ -1290,12 +1289,16 @@ void CLI::desugarPlainArgs ()
|
||||||
{
|
{
|
||||||
std::vector <A> reconstructed;
|
std::vector <A> reconstructed;
|
||||||
std::vector <A>::iterator a;
|
std::vector <A>::iterator a;
|
||||||
|
std::vector <A>::iterator prev = _args.begin ();
|
||||||
for (a = _args.begin (); a != _args.end (); ++a)
|
for (a = _args.begin (); a != _args.end (); ++a)
|
||||||
{
|
{
|
||||||
if (a->hasTag ("FILTER") &&
|
if (a != prev && // Not the first arg.
|
||||||
|
! prev->hasTag ("OP") && // An OP before protects the arg.
|
||||||
|
a->hasTag ("FILTER") &&
|
||||||
! a->hasTag ("ATTRIBUTE") &&
|
! a->hasTag ("ATTRIBUTE") &&
|
||||||
! a->hasTag ("ATTMOD") &&
|
! a->hasTag ("ATTMOD") &&
|
||||||
! a->hasTag ("OP") &&
|
! a->hasTag ("OP") &&
|
||||||
|
! a->hasTag ("REGEX") &&
|
||||||
! a->hasTag ("LITERAL"))
|
! a->hasTag ("LITERAL"))
|
||||||
{
|
{
|
||||||
A lhs ("argPattern", "description");
|
A lhs ("argPattern", "description");
|
||||||
|
@ -1315,6 +1318,8 @@ void CLI::desugarPlainArgs ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
reconstructed.push_back (*a);
|
reconstructed.push_back (*a);
|
||||||
|
|
||||||
|
prev = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
_args = reconstructed;
|
_args = reconstructed;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue