#!/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))