GothenburgBitFactory / tasklib

A Python library for interacting with taskwarrior databases.
http://tasklib.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
147 stars 28 forks source link

Output feedback text #60

Open ghost opened 5 years ago

ghost commented 5 years ago

Thank you for making/maintaining tasklib!

Per https://taskwarrior.org/docs/hooks.html (my emphasis):

Output from a hook script is a combination of a JSON-formatted task and text. Just as the JSON for a task must occupy a single line, so must a single feedback message. Feedback text is optional for a successful hook script, but required for a failing script. If provided it will be displayed by Taskwarrior according to the verbosity setting.

Here is sample output from a hypothetical spell-checking hook script:

{"description":"Buy some milk","entry":"20141118T050231Z","status":"pending","uuid":"a360fc44-315c-4366-b70c-ea7e7520b749"}
Spell checking found no errors.

The output is a single line JSON object which represents an optionally modified task, and a single line of feedback text to be displayed.

There may only be one line of JSON, and it must be for the same task that was provided as input.

However, tasklib does not seem to have a (documented) way to output feedback text.

ghost commented 5 years ago

A workaround is to do something like (e.g. for a failing hook):

print("Hook failed!")
sys.exit(1)

If this is the intended approach for handling feedback text with tasklib, then it should ideally be mentioned in the tasklib docs, and then this issue closed as fixed.

Alternatively, if another approach is intended, then that other approach should be documented/implemented.