mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI
- Implemented ::exactMatch.
This commit is contained in:
parent
b0cf4adc4e
commit
227e0bd8c8
1 changed files with 23 additions and 0 deletions
23
src/CLI.cpp
23
src/CLI.cpp
|
@ -105,6 +105,29 @@ void CLI::aliasExpansion ()
|
|||
dump ("CLI::aliasExpansion");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Search for exact 'value' in _entities category.
|
||||
bool CLI::exactMatch (
|
||||
const std::string& category,
|
||||
const std::string& value) 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 (category);
|
||||
|
||||
// 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)
|
||||
{
|
||||
// Shortcut: if an exact match is found, success.
|
||||
if (value == e->second)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CLI::dump (const std::string& label) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue