Skip to content

Commit ed33f32

Browse files
committed
Simplified help function
1 parent 16e09bb commit ed33f32

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

cmd2/cmd2.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,16 +2596,11 @@ def do_help(self, arglist: List[str]) -> None:
25962596
else:
25972597
# Getting help for a specific command
25982598
func = self.cmd_func(arglist[0])
2599-
if func:
2600-
# Check to see if this function was decorated with an argparse ArgumentParser
2601-
if hasattr(func, 'argparser'):
2602-
completer = AutoCompleter(getattr(func, 'argparser'), cmd2_app=self)
2603-
self.poutput(completer.format_help(arglist))
2604-
else:
2605-
# No special behavior needed, delegate to cmd base class do_help()
2606-
super().do_help(arglist[0])
2599+
if func and hasattr(func, 'argparser'):
2600+
completer = AutoCompleter(getattr(func, 'argparser'), cmd2_app=self)
2601+
self.poutput(completer.format_help(arglist))
26072602
else:
2608-
# This could be a help topic
2603+
# No special behavior needed, delegate to cmd base class do_help()
26092604
super().do_help(arglist[0])
26102605

26112606
def _help_menu(self, verbose: bool=False) -> None:

0 commit comments

Comments
 (0)