Created
April 16, 2019 09:03
-
-
Save andreas-wilm/86c3af73a21a17e5b960263f12916452 to your computer and use it in GitHub Desktop.
on-add hook to add default priority to taskwarrior tasks if not specified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import json | |
DEF_PRIO = 'M' | |
added_task = json.loads(sys.stdin.readline()) | |
if 'priority' not in added_task: | |
sys.stderr.write("Adding default priority: {}\n".format(DEF_PRIO)) | |
added_task['priority'] = DEF_PRIO | |
# see https://taskwarrior.org/docs/hooks_guide.html | |
# save as .task/hooks/on-add | |
print(json.dumps(added_task)) | |
sys.exit(0) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment