Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output feedback text #5

Open
ghost opened this issue Dec 19, 2018 · 1 comment
Open

Output feedback text #5

ghost opened this issue Dec 19, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 19, 2018

Thank you for making/maintaining taskpirate!

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.

tasklib does not explicitly support feedback text yet, but in some ways that is less of an issue, as it interfaces with TaskWarrior more directly.

taskpirate, adding as it does an abstraction layer between tasklib and hooks, does not seem to have a (documented) mechanism for sending feedback text from a hook back to taskpirate, together with JSON. That is, it has no (documented) mechanism for fully utilising TaskWarrior's hook support. This should probably be addressed.

@ghost
Copy link
Author

ghost commented Dec 19, 2018

For failing hooks, a workaround is to do something within the hook like:

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants