summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-09-28 13:03:36 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-09-28 13:03:36 -0400
commited33f32b5924be3866c147bf8eaf088e65cd101d (patch)
treec1fe6376a7f41db68d3414ed978de68f8d211d67
parent16e09bb5648141bae0b4b43adf57b18a64ea5ae4 (diff)
downloadcmd2-git-ed33f32b5924be3866c147bf8eaf088e65cd101d.tar.gz
Simplified help function
-rw-r--r--cmd2/cmd2.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 8203203d..d029aa6c 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2596,16 +2596,11 @@ class Cmd(cmd.Cmd):
else:
# Getting help for a specific command
func = self.cmd_func(arglist[0])
- if func:
- # Check to see if this function was decorated with an argparse ArgumentParser
- if hasattr(func, 'argparser'):
- completer = AutoCompleter(getattr(func, 'argparser'), cmd2_app=self)
- self.poutput(completer.format_help(arglist))
- else:
- # No special behavior needed, delegate to cmd base class do_help()
- super().do_help(arglist[0])
+ if func and hasattr(func, 'argparser'):
+ completer = AutoCompleter(getattr(func, 'argparser'), cmd2_app=self)
+ self.poutput(completer.format_help(arglist))
else:
- # This could be a help topic
+ # No special behavior needed, delegate to cmd base class do_help()
super().do_help(arglist[0])
def _help_menu(self, verbose: bool=False) -> None: