click-repl icon indicating copy to clipboard operation
click-repl copied to clipboard

Entering ". ", "/ ", etc.. shows usage

Open thomask77 opened this issue 1 year ago • 0 comments

If you enter ". ", "/ " or similar, as soon as you hit space, the usage is displayed.

As a workaround, I added the following code in _completer.py:

diff --git a/Tests/click/third_party/click_repl/_completer.py b/Tests/click/third_party/click_repl/_completer.py
index 67b8bda..6f531db 100644
--- a/Tests/click/third_party/click_repl/_completer.py
+++ b/Tests/click/third_party/click_repl/_completer.py
@@ -275,6 +275,17 @@ class ClickCompleter(Completer):
         if self.parsed_args != args:
             self.parsed_args = args
             try:
+                # 2024-01-24, tk:
+                #
+                # Without resilient_parsing, entering ". ", "^ ", etc..
+                # prints the usage. (But not "x " - strange!)
+                #
+                # I'm not sure, if this is the correct place to fix it.
+                #
+                # See https://github.com/click-contrib/click-repl/issues/113
+                #
+                self.ctx.resilient_parsing = True
+

thomask77 avatar Jan 26 '24 11:01 thomask77