diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-11-12 16:03:31 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-11-12 16:03:31 -0500 |
commit | d37f2cc896f2ac5147885c9ed30284df28a09422 (patch) | |
tree | 418221b4ff5bbac3b900964022b5cc6072b88780 | |
parent | f02cf54284c4feacee5647d29665158fa5137f5f (diff) | |
parent | baf0392007659d069a7fed543335ac5e0e937556 (diff) | |
download | cmd2-git-d37f2cc896f2ac5147885c9ed30284df28a09422.tar.gz |
Merge branch 'master' into 2.0
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | cmd2/argparse_completer.py | 8 | ||||
-rwxr-xr-x | tests/test_completion.py | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 460a2018..652c495c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ See [read_input.py](https://github.com/python-cmd2/cmd2/blob/master/examples/read_input.py) for an example. +## 1.4.1 (TBD, 2020) +* Bug Fixes + * Fixed bug where setting `always_show_hint=True` did not show a hint when completing `Settables` + ## 1.4.0 (November 11, 2020) * Bug Fixes * Fixed tab completion crash on Windows diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py index 316d4666..f42e2a88 100644 --- a/cmd2/argparse_completer.py +++ b/cmd2/argparse_completer.py @@ -423,7 +423,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 @@ -444,7 +446,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 diff --git a/tests/test_completion.py b/tests/test_completion.py index 48f93a5a..a9f2a51b 100755 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -971,6 +971,7 @@ def test_complete_set_value(cmd2_app): first_match = complete_tester(text, line, begidx, endidx, cmd2_app) assert first_match == "SUCCESS " + assert cmd2_app.completion_hint == "Hint:\n value a settable param\n" def test_complete_set_value_invalid_settable(cmd2_app, capsys): text = '' |