[pypy-svn] r13371 - pypy/branch/pycompiler/bin
adim at codespeak.net
adim at codespeak.net
Tue Jun 14 11:12:15 CEST 2005
Author: adim
Date: Tue Jun 14 11:12:14 2005
New Revision: 13371
Modified:
pypy/branch/pycompiler/bin/translator.py
Log:
added readline / history / tab support for translator shell
(fed up with always retyping the same things ... )
this will probably reamain local to the pycompiler branch
Modified: pypy/branch/pycompiler/bin/translator.py
==============================================================================
--- pypy/branch/pycompiler/bin/translator.py (original)
+++ pypy/branch/pycompiler/bin/translator.py Tue Jun 14 11:12:14 2005
@@ -36,7 +36,25 @@
from pypy.translator.translator import Translator
+def setup_readline():
+ import readline
+ import rlcompleter
+ readline.parse_and_bind("tab: complete")
+ import os
+ histfile = os.path.join(os.environ["HOME"], ".pypytrhist")
+ print "reading history file ..."
+ try:
+ readline.read_history_file(histfile)
+ except IOError:
+ pass
+ print "done"
+ import atexit
+ atexit.register(readline.write_history_file, histfile)
+ del os, histfile
+
+
if __name__ == '__main__':
+ setup_readline()
from pypy.translator.test import snippet as test
if (os.getcwd() not in sys.path and
os.path.curdir not in sys.path):
More information about the Pypy-commit
mailing list