taskwarrior
taskwarrior copied to clipboard
Question about adding a hook
I have an use case where it'd be very helpful to have a hook at the time of urgency calculation. Basically here: https://github.com/GothenburgBitFactory/taskwarrior/blob/1c11f8b650cdd15526c6694d9032b645485660fa/src/Task.cpp#L2202
Having such hook, while potentially detrimental to speed (like any other hook), would give advanced users a lot of flexibility to bring interesting "business" rules to the urgency calculation. Just as an example, what I'd like to do is change the urgency of a task based on a formula taking as input the value of a numeric UDA I defined.
I'm happy to implement it and make a PR, but before spending the time I'd like to know if there's interest and a feature like that has any chance of being considered for merging.
Thanks!
See also #133 for some ideas about how dynamic urgency calculation might work within taskwarrior configuration.
I saw that @ryneeverett but a few thoughts
- Adding the commitment to parse and execute math formulas from the config file would be a huge step. That feature needs a lot of thinking and testing to make it viable.
- Even if we did that, a hook for the dynamic urgency calculation is still a good idea, as it'd allow users to do whatever they want and not just formulas. You may want to check an external source, etc.
Fair points!
My line of thinking is that urgency calculation within configuration requires a pattern that wouldn't have the performance problems of checking external sources on-demand:
- An external daemon updates the taskwarrior database with whatever data you need from external sources
- Taskwarrior dynamically calculates urgency based on that data.
Of course this could just as easily be implemented with a hook for (2) and maybe that's a better idea.
I had some time during a long flight and put a PR together. Would love to get some comments.