Align parsed() call with cmd2 versions >= 0.7.3

In version 0.7.3, cmd2 moved the parsed method from class Cmd()
to class ParserManager().

Change-Id: Ie0c057ffaeaa05c4f5e0f3599aab850245c55066
Closes-Bug: #1751822
This commit is contained in:
Corey Bryant 2018-02-28 10:49:24 -05:00 committed by Sorin Sbarnea
parent e5d7f40005
commit 085310c89c
1 changed files with 7 additions and 1 deletions

View File

@ -111,7 +111,13 @@ class InteractiveApp(cmd2.Cmd):
# Dispatch to the underlying help command,
# which knows how to provide help for extension
# commands.
self.default(self.parsed('help ' + arg))
try:
# NOTE(coreycb): This try path can be removed once
# requirements.txt has cmd2 >= 0.7.3.
parsed = self.parsed
except AttributeError:
parsed = self.parser_manager.parsed
self.default(parsed('help ' + arg))
else:
cmd2.Cmd.do_help(self, arg)
cmd_names = sorted([n for n, v in self.command_manager])