- Added helper method ::scripts to filter by event and accessibility.
This commit is contained in:
Paul Beckingham 2014-05-14 17:45:42 -04:00
parent dee6f3a713
commit c86853fd03
2 changed files with 19 additions and 0 deletions

View file

@ -242,6 +242,24 @@ void Hooks::onModify (const Task& before, Task& after)
context.timer_hooks.stop ();
}
////////////////////////////////////////////////////////////////////////////////
std::vector <std::string> Hooks::scripts (const std::string& event)
{
std::vector <std::string> matching;
std::vector <std::string>::iterator i;
for (i = _scripts.begin (); i != _scripts.end (); ++i)
{
if (i->find ("/" + event) != std::string::npos)
{
File script (*i);
if (script.executable ())
matching.push_back (*i);
}
}
return matching;
}
////////////////////////////////////////////////////////////////////////////////
int Hooks::execute (
const std::string& command,