def _run(self):
args = {
'history': history.InMemoryHistory(),
'enable_history_search': True,
'enable_open_in_editor': True,
'lexer': lexer,
'completer': get_completer(self._environment, self._couch_server),
'style': style,
}
while True:
try:
cli = pt.CommandLineInterface(application=shortcuts.create_prompt_application(self.prompt, **args),
eventloop=shortcuts.create_eventloop())
self._environment.cli = cli
cmd_text = cli.run().text.rstrip()
eval_(self._environment, self._couch_server, cmd_text)
cli.reset()
except RuntimeError as e:
self._environment.output(str(e))
except (EOFError, KeyboardInterrupt):
self._environment.output('Exiting...')
break
评论列表
文章目录