Skip to content

Commit 895637c

Browse files
authored
Merge pull request #605 from python-cmd2/del_complete_help
Moved some class specific code out of __init__
2 parents fb3486f + b025b39 commit 895637c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd2/cmd2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,6 @@ def __init__(self, completekey: str='tab', stdin=None, stdout=None, persistent_h
394394
# Call super class constructor
395395
super().__init__(completekey=completekey, stdin=stdin, stdout=stdout)
396396

397-
# Get rid of cmd's complete_help() functions so AutoCompleter will complete our help command
398-
if getattr(cmd.Cmd, 'complete_help', None) is not None:
399-
delattr(cmd.Cmd, 'complete_help')
400-
401397
# Commands to exclude from the help menu and tab completion
402398
self.hidden_commands = ['eof', 'eos', '_relative_load']
403399

@@ -2584,6 +2580,10 @@ def complete_help_subcommand(self, text: str, line: str, begidx: int, endidx: in
25842580
help_parser.add_argument('-v', '--verbose', action='store_true',
25852581
help="print a list of all commands with descriptions of each")
25862582

2583+
# Get rid of cmd's complete_help() functions so AutoCompleter will complete the help command
2584+
if getattr(cmd.Cmd, 'complete_help', None) is not None:
2585+
delattr(cmd.Cmd, 'complete_help')
2586+
25872587
@with_argparser(help_parser)
25882588
def do_help(self, args: argparse.Namespace) -> None:
25892589
"""List available commands or provide detailed help for a specific command"""

0 commit comments

Comments
 (0)