Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Proof of concept for an interactive Taskwarrior hook. Hackish and potentially problematic, but it works.
#!/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))
@linuxcaffe

This comment has been minimized.

Copy link

@linuxcaffe linuxcaffe commented Mar 22, 2015

interesting! Proof of concept, you say?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.