mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-07 22:58:34 +02:00
Hooks
- Added helper method ::scripts to filter by event and accessibility.
This commit is contained in:
parent
dee6f3a713
commit
c86853fd03
2 changed files with 19 additions and 0 deletions
|
@ -242,6 +242,24 @@ void Hooks::onModify (const Task& before, Task& after)
|
||||||
context.timer_hooks.stop ();
|
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 (
|
int Hooks::execute (
|
||||||
const std::string& command,
|
const std::string& command,
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
void onModify (const Task&, Task&);
|
void onModify (const Task&, Task&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::vector <std::string> scripts (const std::string&);
|
||||||
int execute (const std::string&, const std::string&, std::string&);
|
int execute (const std::string&, const std::string&, std::string&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue