Created
March 21, 2015 21:22
-
-
Save wbsch/f592b37c249decf65395 to your computer and use it in GitHub Desktop.
Proof of concept for an interactive Taskwarrior hook. Hackish and potentially problematic, but it works.
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 characters
#!/usr/bin/env python | |
# | |
# PoC: Interactive on-add hook | |
import json | |
import sys | |
t = json.loads(sys.stdin.readline()) | |
real_stdin = open("/dev/tty", "r") | |
real_stdout = open("/dev/tty", "w") | |
if "teh" in t['description']: | |
real_stdout.write('You misspelled "the". Should I correct that for you? [Y/n] ') | |
real_stdout.flush() | |
i = real_stdin.readline().rstrip() | |
if i == "y" or i == "Y" or i == "": | |
t['description'] = t['description'].replace("teh", "the") | |
print(json.dumps(t)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
interesting! Proof of concept, you say?!