mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI
- Implemented ::findOperators.
This commit is contained in:
parent
fab9fe2a7d
commit
7f3cc3897e
2 changed files with 23 additions and 0 deletions
22
src/CLI.cpp
22
src/CLI.cpp
|
@ -312,6 +312,7 @@ void CLI::analyze ()
|
|||
desugarPatterns ();
|
||||
desugarIDs ();
|
||||
desugarUUIDs ();
|
||||
findOperators ();
|
||||
insertJunctions ();
|
||||
|
||||
// Decompose the elements for MODIFICATIONs.
|
||||
|
@ -1191,6 +1192,27 @@ void CLI::desugarUUIDs ()
|
|||
_args = reconstructed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CLI::findOperators ()
|
||||
{
|
||||
// Find the category.
|
||||
std::pair <std::multimap <std::string, std::string>::const_iterator, std::multimap <std::string, std::string>::const_iterator> c;
|
||||
c = _entities.equal_range ("operator");
|
||||
|
||||
// Extract a list of entities for category.
|
||||
std::vector <std::string> options;
|
||||
std::multimap <std::string, std::string>::const_iterator e;
|
||||
for (e = c.first; e != c.second; ++e)
|
||||
options.push_back (e->second);
|
||||
|
||||
// Walk the arguments and tag as OP.
|
||||
std::vector <A>::iterator a;
|
||||
for (a = _args.begin (); a != _args.end (); ++a)
|
||||
if (a->hasTag ("FILTER"))
|
||||
if (std::find (options.begin (), options.end (), a->attribute ("raw")) != options.end ())
|
||||
a->tag ("OP");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Two consecutive FILTER, ID or UUID arguments:
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue