Collection of Taskwarrior hooks
Project description
Taskwarrior Hooks
TODO Register app in coveralls - set COVERALLS_REPO_TOKEN
Description
This is a collection of Taskwarrior
hooks that I use in my
day-to-day workflows. It comes along a detection and easy-registration mechanism
that should make it easy to develop and then distribute your own hooks. The
hooks are structured as classes under the tw_hooks/hooks
directory.
Installation
Install it from PyPI
:
pip3 install --user --upgrade tw_hooks
To get the latest version install directly from source:
pip3 install --user --upgrade git+https://github.com/bergercookie/tw-hooks
After the installation, you have to run the install_hook_shims
executable
(which by this point should be in your $PATH
). Running it will create shims
(thin wrapper scripts) under ~/.task/hooks
in order to register all the hooks
with Taskwarrior.
Available hooks
Currently the following hooks are available:
TODO
Structure of a Hook
The purpose of this package is to facilitate the development and distribution of
Taskwarrior hooks. To this purpose install_hook_shims
allows you to easily
register your own hooks, without having to manually copy items over to the
taskwarrior hooks location. install_hook_shims
will install a shim which will
call your hook automatically when required.
This is an example of a Taskwarrior hook that will be executed on Taskwarrior exit:
from tw_hooks import OnExitHook
class WarnOnTaskCongestion(OnExitHook):
"""Warn the user if there are too many tasks."""
def _on_exit(self, _): # <--- Mandatory to implement this signature
# ...
return 0
Assuming that this hook is in a module called warn_on_task_congestion.py
and
that the directory of this module is in your python path (e.g., by adding it
explicitly to $PYTHONPATH
), then you can run the following to register your
hook with taskwarrior:
install_hook_shims -r warn_on_task_congestion
During your next Taskwarrior operation, if there are too many due:today tasks, you should see something like this:
t add +test kalimera
Created task 719.
[WarnOnTaskCongestion] Too many due:today tasks [threshold=9]
Hooks API
TODO
Usage instructions for install_hook_shims
TODO
Miscellaneous
Self Promotion
If you find this tool useful, please star it on Github and consider donating.
Support
If something doesn't work, feel free to open an issue. You can also find me in the #taskwarrior Libera Chat.
TODO List
See ISSUES list for the things that I'm currently either working on or interested in implementing in the near future. In case there's something you are interesting in working on, don't hesitate to either ask for clarifications or just do it and directly make a PR.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.