diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-11-12 13:26:19 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-11-12 13:26:19 -0500 |
commit | 59528a925300d67d05b5504441e0a4d7ea072acc (patch) | |
tree | 5dc896dd8b85b25545a77cd71f1d953fa967ed46 /cmd2 | |
parent | d4dc6b6a98fdb44b08701a3826ee88b6c22b72fd (diff) | |
download | cmd2-git-settable_hint.tar.gz |
Fixed bug where setting always_show_hint=True did not show a hint when completing Settablessettable_hint
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/argparse_completer.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py index 7484358d..117bfd50 100644 --- a/cmd2/argparse_completer.py +++ b/cmd2/argparse_completer.py @@ -415,7 +415,9 @@ class ArgparseCompleter: # If we have results, then return them if completion_results: - self._cmd2_app.completion_hint = _build_hint(self._parser, flag_arg_state.action) + # Don't overwrite an existing hint + if not self._cmd2_app.completion_hint: + self._cmd2_app.completion_hint = _build_hint(self._parser, flag_arg_state.action) return completion_results # Otherwise, print a hint if the flag isn't finished or text isn't possibly the start of a flag @@ -437,7 +439,9 @@ class ArgparseCompleter: # If we have results, then return them if completion_results: - self._cmd2_app.completion_hint = _build_hint(self._parser, pos_arg_state.action) + # Don't overwrite an existing hint + if not self._cmd2_app.completion_hint: + self._cmd2_app.completion_hint = _build_hint(self._parser, pos_arg_state.action) return completion_results # Otherwise, print a hint if text isn't possibly the start of a flag |