78def configureInteractivePrompt(completionDict = None):
79 """Configure interactive prompt. The optional completionDict is used to
80 configure the readline completer."""
81
82
83 import atexit
84 import readline
85 import rlcompleter
86
87 fhistory = os.path.expanduser( '~/.athena.history' )
88
89 if completionDict is not None:
90 readline.set_completer(rlcompleter.Completer(completionDict).complete)
91
92 readline.parse_and_bind( 'tab: complete' )
93 readline.parse_and_bind( 'set show-all-if-ambiguous On' )
94
95 if os.path.exists( fhistory ):
96 readline.read_history_file( fhistory )
97
98 readline.set_history_length( 1024 )
99
100
101 atexit.register( readline.write_history_file, fhistory )
102
103
104 sys.excepthook = ShellEscapes()