GothenburgBitFactory / GothenburgBitFactory/taskwarrior

[TW-1322] Task dependencies and triggers on certain events for individual tasks

Open
#1,354 2 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
C++
Stars
6.1k
Forks
423
Avg merge
1d 19h
Merged PRs (30d)
11

Description

_Renato Alves on 2014-05-13T13:54:05Z says:_

The idea of this request is similar to that of "event hooks" except these will work for individual tasks.

The idea of "event hooks" is meant to act as a way to define behaviours that affect all tasks equally, such as displaying a pop-up on task completion.

The present proposal aims at defining a possible interface to also have this functionality on a per-task basis.

Example:
```
task add "Find nearest ATM"
task add "Get money from ATM"
task list

ID UUID Desc
1 3def... Find nearest ATM
2 4abc... Get money from ATM

task add "Pay the rent" depends:2 oncomplete:'4abc... mod due:30d ; 3def... mod due:1d'
```

Some new keywords could be (not exhaustive):
* oncomplete
* onmodify
* ondelete
* ondue (trigger when due date is reached)
* onchild (trigger when a new task is created from a recurrent task)

These could very well be the same as the "event hooks" above, but defined for individual task use instead of global.

The syntax of the command being triggered would be the same as the command line without the "task" keyword, hence:
`4abc... mod due:30d` is equivalent to `task 4abc... mod due:30d`. A `;` would be used as separator for multiple actions.
In order to make triggers reliable, task identifiers should always be `UUID`.
For more complex patterns such as `proj:afterCompletion modify due:30d` the filter will have to be applied only at trigger time.

*Disclaimer*: The use of this feature (like many others) will require discipline since target tasks may no longer exist at time of triggering.

*NOTE*
Some care should be taken to deny cyclical triggers such as tasks that modify each other.

A special keyword/tag `+notrigger` should also be created to prevent triggers from firing in some situations.
This could be used like so:
```
task add "Pay the rent" depends:2 oncomplete:'2 mod +notrigger due:30d ; 1 mod +notrigger due:1d'
```
To prevent the triggered modifications from firing existing triggers.

*Non features*
Using the triggers mentioned to fire external commands is not part of this proposal.
For external scripts global "event hooks" should be used instead.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.