Skip to content

Instantly share code, notes, and snippets.

@tbabej
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbabej/48afb4d94634185926e5 to your computer and use it in GitHub Desktop.
Save tbabej/48afb4d94634185926e5 to your computer and use it in GitHub Desktop.
Taskwarrior on-add antiduplicate hook
#!/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