summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-10-03 01:43:41 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-10-03 01:43:41 -0400
commit6e546611bbc5139bcde898c6d8d6e5f9656f9510 (patch)
treee5411cf3f53ea54cdbf29211937ba3ec21737c90 /cmd2
parent9299494a3578aa37afc6d7ca0977e4e49df35f8a (diff)
downloadcmd2-git-6e546611bbc5139bcde898c6d8d6e5f9656f9510.tar.gz
Don't recognize help functions for argparse commands
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/cmd2.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 29423e63..17f9f202 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2687,9 +2687,11 @@ class Cmd(cmd.Cmd):
topics = self.get_help_topics()
for command in cmds:
- # First see if there's a help function implemented
- if command in topics:
- func = getattr(self, HELP_FUNC_PREFIX + command)
+ cmd_func = self.cmd_func(command)
+
+ # Non-argparse commands can have help_functions for their documentation
+ if not hasattr(cmd_func, 'argparser') and command in topics:
+ help_func = getattr(self, HELP_FUNC_PREFIX + command)
result = io.StringIO()
# try to redirect system stdout
@@ -2699,16 +2701,14 @@ class Cmd(cmd.Cmd):
try:
# redirect our internal stdout
self.stdout = result
- func()
+ help_func()
finally:
# restore internal stdout
self.stdout = stdout_orig
doc = result.getvalue()
else:
- # Couldn't find a help function
- func = self.cmd_func(command)
- doc = func.__doc__
+ doc = cmd_func.__doc__
# Attempt to locate the first documentation block
doc_block = []