Created
September 5, 2015 19:24
-
-
Save wbsch/b3e6786f03795f7edc6b to your computer and use it in GitHub Desktop.
Revisions
-
wbsch created this gist
Sep 5, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/usr/bin/env python3 # # Save as on-add_annotate.py in hooks directory, then: # $ chmod +x ~/.task/hooks/on-add_annotate.py # # Anything after "annotate:" in a new task's description is added as an # annotation: # $ task add this is the description annotate:this is an annotation import json import sys task = json.loads(sys.stdin.readline()) try: desc, anno = task["description"].split(" annotate:") task["description"] = desc task["annotations"] = [{"entry": task["entry"], "description": anno}] except ValueError: pass print(json.dumps(task))