mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Rules: ::all now matches keys against a stem
This commit is contained in:
parent
f65ec8c16a
commit
5a8c3e11ae
2 changed files with 6 additions and 4 deletions
|
@ -146,12 +146,14 @@ void Rules::set (const std::string& key, const std::string& value)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Provide a vector of all configuration keys.
|
||||
std::vector <std::string> Rules::all () const
|
||||
// Provide a vector of all configuration keys. If a stem is provided, only
|
||||
// return matching keys.
|
||||
std::vector <std::string> Rules::all (const std::string& stem) const
|
||||
{
|
||||
std::vector <std::string> items;
|
||||
for (const auto& it : _settings)
|
||||
items.push_back (it.first);
|
||||
if (stem == "" || it.first.find (stem) == 0)
|
||||
items.push_back (it.first);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue