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)
评论列表
文章目录