Adding in some readline cuteness
This commit is contained in:
parent
ccd26205d7
commit
eb356cb12b
9
bin/hy
9
bin/hy
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import hy
|
import hy
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
@ -52,9 +53,17 @@ class HyREPL(code.InteractiveConsole):
|
|||||||
sys.ps1 = "=> "
|
sys.ps1 = "=> "
|
||||||
sys.ps2 = "... "
|
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 = HyREPL()
|
||||||
hr.interact("{appname} {version}".format(
|
hr.interact("{appname} {version}".format(
|
||||||
appname=hy.__appname__,
|
appname=hy.__appname__,
|
||||||
version=hy.__version__
|
version=hy.__version__
|
||||||
))
|
))
|
||||||
|
readline.write_history_file(history)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user