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,11 +146,13 @@ void Rules::set (const std::string& key, const std::string& value)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Provide a vector of all configuration keys.
|
// Provide a vector of all configuration keys. If a stem is provided, only
|
||||||
std::vector <std::string> Rules::all () const
|
// return matching keys.
|
||||||
|
std::vector <std::string> Rules::all (const std::string& stem) const
|
||||||
{
|
{
|
||||||
std::vector <std::string> items;
|
std::vector <std::string> items;
|
||||||
for (const auto& it : _settings)
|
for (const auto& it : _settings)
|
||||||
|
if (stem == "" || it.first.find (stem) == 0)
|
||||||
items.push_back (it.first);
|
items.push_back (it.first);
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
void set (const std::string&, const double);
|
void set (const std::string&, const double);
|
||||||
void set (const std::string&, const std::string&);
|
void set (const std::string&, const std::string&);
|
||||||
|
|
||||||
std::vector <std::string> all () const;
|
std::vector <std::string> all (const std::string& stem = "") const;
|
||||||
|
|
||||||
std::string dump () const;
|
std::string dump () const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue