-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add SuppressCompleter to skip completion for specific arguments while allowing help text #224
Conversation
test/test.py
Outdated
("prog ", ["--foo", "--bar", "-h", "--help"]), | ||
("prog --b", ["--bar "]) | ||
("prog ", ["--foo", "--bar", "--baz", "-h", "--help"]), | ||
("prog --b", ["--bar", "--baz"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why I had to remove the trailing space for the existing option --bar
?
Codecov Report
@@ Coverage Diff @@
## master #224 +/- ##
==========================================
+ Coverage 87.97% 88.14% +0.16%
==========================================
Files 5 5
Lines 632 641 +9
==========================================
+ Hits 556 565 +9
Misses 76 76
Continue to review full report at Codecov.
|
Please create a separate test instead of modifying an existing test. Please add a docstring to |
The lack of a trailing space is suspicious. By default we add a trailing space if there is only one completion, but it seems like that shouldn't change in your test. Once you refactor the test case to be its own test case, I'll take a closer look into what's going on there. |
I thought it would make sense to put the additional check into the similar existing test. I have separated it in 89c3a0e.
Done in 1b3629e
With the separation the tests I didn't have to change the existing test and also the new test uses the trailing space. I could squash the third commit with the first one as well as the fourth with the second if you would like to keep a clean commit history? |
Thanks. That's all right, I can squash merge when I'm done reviewing, unless you really want me to rebase merge. |
The tests don't show what happens when the user types |
For the specific test where one argument is expected after |
@kislyuk @evanunderscore Please let me know if there is anything else I can do for this patch. Thanks. |
Looks good, I verified that there was no problem with the trailing space. Thanks for your patience @dirk-thomas. |
Released in v1.9.2. |
Fixes #223.
The first commit adds the
SuppressCompleter
as described in the feature request.The second commit adds a method to it which makes the actual decision if the completion should be suppressed. The default implementation is to suppress the completion. But it allows to override the decision making in a subclass and use whatever reasoning to decide to show or suppress the completion.