Last active
August 29, 2015 14:13
-
-
Save tbabej/48afb4d94634185926e5 to your computer and use it in GitHub Desktop.
Taskwarrior on-add antiduplicate hook
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/python | |
# Install tasklib from my hooks branch | |
# sudo pip install --force git+git://github.com/tbabej/tasklib@hooks2 | |
import sys | |
from tasklib.task import TaskWarrior, Task | |
tw = TaskWarrior() # Use data_location for alternate locations, see docs | |
task = Task.from_input() | |
if task['parent']: | |
if len(tw.tasks.filter(parent=task['parent'], due=task['due'])): | |
print "Duplicate recurrent task blocked: %s" % task['description'] | |
sys.exit(1) | |
print task.export_data() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment