def onecmd(self, line):
"""
Wrap error handling around cmd.Cmd.onecmd(). Might want to do
something kinder than showing a traceback, eventually.
"""
self.last_command_failed = False
try:
return cmd.Cmd.onecmd(self, line)
except SystemExit:
raise
except ExitArgparse, e:
if e.message is not None:
print e.message
self.last_command_failed = e.status != 0
return False
except BadCommandSyntax, e:
print e
except Exception:
traceback.print_exc()
self.last_command_failed = True
return False
评论列表
文章目录