Adding in some readline cuteness

This commit is contained in:
Paul Tagliamonte 2013-03-25 19:10:59 -04:00
parent ccd26205d7
commit eb356cb12b
1 changed files with 9 additions and 0 deletions

9
bin/hy
View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
import hy
import os
import sys
@ -52,9 +53,17 @@ class HyREPL(code.InteractiveConsole):
sys.ps1 = "=> "
sys.ps2 = "... "
history = os.path.expanduser("~/.hy-history")
readline.parse_and_bind("set blink-matching-paren on")
try:
readline.read_history_file(history)
except IOError:
open(history, 'wa').close()
hr = HyREPL()
hr.interact("{appname} {version}".format(
appname=hy.__appname__,
version=hy.__version__
))
readline.write_history_file(history)