mole.py 文件源码

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

项目:themole 作者: tiankonguse 项目源码 文件源码
def start(self):
        while True:
            try:
                signal.signal(signal.SIGINT, signal.default_int_handler)
                try:
                    #line = [i for i in input('#> ').strip().split(' ') if len(i) > 0]
                    line = input('#> ')
                except KeyboardInterrupt:
                    output_manager.line_break()
                    continue

                cmd_name = line.strip().split(' ')
                if len(cmd_name) > 0 and len(cmd_name[0]) > 0:
                    cmd = cmd_manager.find(cmd_name[0])
                    if cmd.requires_smart_parse():
                        line = self.completer.smart_parse(line)
                    else:
                        line = self.completer.nice_split(line)
                    signal.signal(signal.SIGINT, sigint_handler)
                    cmd.execute(self.mole, line[1:] if len(line) > 1 else [])
            except commands.CommandException as ex:
                output_manager.error(str(ex)).line_break()
                if ex.print_usage:
                    output_manager.normal(' Usage: {0}'.format(cmd.usage(line[0]))).line_break()
            except commands.CmdNotFoundException as ex:
                output_manager.error('Error: {0}'.format(ex)).line_break()
            except commands.QuietCommandException:
                pass
            except EOFError:
                output_manager.line_break()
                self.mole.abort_query()
                self.mole.threader.stop()
                exit(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号