mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Enhancement - Hooks
- Implemented pre-debug, post-debug. - Implemented pre-header, post-header. - Implemented pre-output, post-output. - Implemented pre-footnote, post-footnote. - Implemented pre-gc, post-gc. - Implemented pre-undo, post-undo. - Implemented pre-add-command, post-add-command.
This commit is contained in:
parent
8540cab0a6
commit
1cd6d4c7e7
4 changed files with 26 additions and 3 deletions
|
@ -343,6 +343,7 @@ void TDB::update (const Task& task)
|
|||
int TDB::commit ()
|
||||
{
|
||||
Timer t ("TDB::commit");
|
||||
context.hooks.trigger ("pre-gc");
|
||||
|
||||
int quantity = mNew.size () + mModified.size ();
|
||||
|
||||
|
@ -362,6 +363,7 @@ int TDB::commit ()
|
|||
writeUndo (*task, mLocations[0].undo);
|
||||
|
||||
mNew.clear ();
|
||||
context.hooks.trigger ("post-gc");
|
||||
return quantity;
|
||||
}
|
||||
|
||||
|
@ -408,6 +410,7 @@ int TDB::commit ()
|
|||
mNew.clear ();
|
||||
}
|
||||
|
||||
context.hooks.trigger ("post-gc");
|
||||
return quantity;
|
||||
}
|
||||
|
||||
|
@ -506,6 +509,7 @@ int TDB::nextId ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TDB::undo ()
|
||||
{
|
||||
context.hooks.trigger ("pre-undo");
|
||||
Directory location (context.config.get ("data.location"));
|
||||
|
||||
std::string undoFile = location.data + "/undo.data";
|
||||
|
@ -670,6 +674,7 @@ void TDB::undo ()
|
|||
// Rewrite files.
|
||||
File::write (pendingFile, p);
|
||||
File::write (undoFile, u);
|
||||
context.hooks.trigger ("post-undo");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -708,6 +713,7 @@ void TDB::undo ()
|
|||
}
|
||||
|
||||
std::cout << "Undo complete." << std::endl;
|
||||
context.hooks.trigger ("post-undo");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue