mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 17:07:19 +02:00
CLI
- Implemented ::isOperator.
This commit is contained in:
parent
6784c8d108
commit
131b08f191
2 changed files with 20 additions and 1 deletions
20
src/CLI.cpp
20
src/CLI.cpp
|
@ -492,7 +492,8 @@ void CLI::addArg (const std::string& arg)
|
|||
isID (arg) || // <id>
|
||||
isPattern (arg) || // /<pattern</
|
||||
isSubstitution (arg) || // /<from>/<to>/[g]
|
||||
isAttribute (arg)) // <name>[.[~]<modfifier>]:<value>
|
||||
isAttribute (arg) || // <name>[.[~]<modfifier>]:<value>
|
||||
isOperator (arg)) // <operator>
|
||||
{
|
||||
_original_args.push_back (arg);
|
||||
}
|
||||
|
@ -1878,3 +1879,20 @@ bool CLI::isAttribute (const std::string& raw) const
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CLI::isOperator (const std::string& raw) const
|
||||
{
|
||||
// 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");
|
||||
|
||||
// Walk the 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)
|
||||
if (raw == e->second)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -109,6 +109,7 @@ private:
|
|||
bool isPattern (const std::string&) const;
|
||||
bool isSubstitution (const std::string&) const;
|
||||
bool isAttribute (const std::string&) const;
|
||||
bool isOperator (const std::string&) const;
|
||||
|
||||
public:
|
||||
std::multimap <std::string, std::string> _entities;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue