repl.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:cdbcli 作者: kevinjqiu 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号