diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-09-13 18:20:58 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-09-13 18:20:58 -0400 |
commit | 9a7818b5a0e22e4ee5b107f6fdcceb3d3612ffd4 (patch) | |
tree | ed1dea8c50f3e4311bf4b2fc79314ce96c784c7b /cmd2/argparse_completer.py | |
parent | 65ed685aad4707e9a8a4a48921d8ca862594d77c (diff) | |
download | cmd2-git-9a7818b5a0e22e4ee5b107f6fdcceb3d3612ffd4.tar.gz |
Fixed issue where invalid subcommand token was ignored when retrieving help text
Diffstat (limited to 'cmd2/argparse_completer.py')
-rw-r--r-- | cmd2/argparse_completer.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py index 89839c25..f1858f23 100644 --- a/cmd2/argparse_completer.py +++ b/cmd2/argparse_completer.py @@ -424,16 +424,17 @@ class AutoCompleter(object): """ Supports cmd2's help command in the retrieval of help text :param tokens: command line tokens - :return: help text of the commmand being queried + :return: help text of the command being queried """ - # If our parser has subcommands, we must examine the tokens and check if any reference one. + # If our parser has subcommands, we must examine the tokens and check if they are subcommands # If so, we will let the subcommand's parser handle the rest of the tokens via another AutoCompleter. if self._subcommand_action is not None: for token_index, token in enumerate(tokens[1:], start=1): if token in self._subcommand_action.choices: completer = AutoCompleter(self._subcommand_action.choices[token], self._cmd2_app) return completer.format_help(tokens[token_index:]) - + else: + break return self._parser.format_help() def _complete_for_arg(self, arg_action: argparse.Action, |