本文整理汇总了Python中cmd2.Cmd.onecmd_plus_hooks方法的典型用法代码示例。如果您正苦于以下问题:Python Cmd.onecmd_plus_hooks方法的具体用法?Python Cmd.onecmd_plus_hooks怎么用?Python Cmd.onecmd_plus_hooks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmd2.Cmd
的用法示例。
在下文中一共展示了Cmd.onecmd_plus_hooks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onecmd_plus_hooks
# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import onecmd_plus_hooks [as 别名]
def onecmd_plus_hooks(self, line, return_none=True):
'''
A single command called with the addtional options provided
to configure the method call.
Returned is the value from the Piped reduce call
or the handler method.
'''
# print 'onecmd_plus_hooks', line
self._lastcmd = line
if PIPE in line:
spl = line.split(PIPE)
return self.run_commands_reduce(spl)
else:
v = Cmd.onecmd_plus_hooks(self, line)
to_quit = False
if v in (QUIT_EXIT, QUIT_NO_EXIT):
to_quit = True
if return_none is False or to_quit:
return v
示例2: onecmd_plus_hooks
# 需要导入模块: from cmd2 import Cmd [as 别名]
# 或者: from cmd2.Cmd import onecmd_plus_hooks [as 别名]
def onecmd_plus_hooks(self, line):
''' Trigger hooks after command. '''
if not line:
return self.emptyline()
return Cmd.onecmd_plus_hooks(self, line)