-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Support different bash completion options #1509
Conversation
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.
Thanks for the quick fix @marckhouzam
I think we should handle insert-completion like menu-complete,
insert-completion is documented to return all current completions.
One cool usecase I could think of is podman rm a[press key for insert-completions]
. This would automatically insert all container names starting with an a
.
Brilliant! I will update the PR. Thanks @Luap99! |
1766812
to
e1bfc78
Compare
PR updated |
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.
LGTM
Do you think it is possible to add a test in your completion-testing repo? |
Should be possible, and we should do it. |
spf13#1508 Based on the documentation found here https://www.gnu.org/software/bash/manual/html_node/Commands-For-Completion.html we remove descriptions for the following completion types: - menu-complete - menu-complete-backward - insert-completions Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
e1bfc78
to
258452a
Compare
These tests cover the issue: spf13/cobra#1508 and the corresponding fix: spf13/cobra#1509 Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
I've done a PR to add tests: marckhouzam/cobra-completion-testing#9 |
These tests cover the issue: spf13/cobra#1508 and the corresponding fix: spf13/cobra#1509 Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Looks like I confused GitHub 🙄 |
spf13#1508 Based on the documentation found here https://www.gnu.org/software/bash/manual/html_node/Commands-For-Completion.html we remove descriptions for the following completion types: - menu-complete - menu-complete-backward - insert-completions Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
spf13#1508 Based on the documentation found here https://www.gnu.org/software/bash/manual/html_node/Commands-For-Completion.html we remove descriptions for the following completion types: - menu-complete - menu-complete-backward - insert-completions Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
spf13#1508 Based on the documentation found here https://www.gnu.org/software/bash/manual/html_node/Commands-For-Completion.html we remove descriptions for the following completion types: - menu-complete - menu-complete-backward - insert-completions Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
spf13#1508 Based on the documentation found here https://www.gnu.org/software/bash/manual/html_node/Commands-For-Completion.html we remove descriptions for the following completion types: - menu-complete - menu-complete-backward - insert-completions Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
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.
Seems good! @marckhouzam - I'm guessing in marckhouzam/cobra-completion-testing we need this merged before we test?
spf13#1508 Based on the documentation found here https://www.gnu.org/software/bash/manual/html_node/Commands-For-Completion.html we remove descriptions for the following completion types: - menu-complete - menu-complete-backward - insert-completions Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
Yes the cobra-completion-testing already had a test for this which was failing until this merge. Thanks for merging @jpmcb ! |
Fixes #1508
Bash completion V2 adds descriptions to completions. However, with certain options, the description must be removed. For example the
menu-complete/menu-complete-backward
bash option will immediately insert on the command-line the first completion returned, therefore we must remove the description to avoid it being added on the command-line also.Based on the documentation found here
https://www.gnu.org/software/bash/manual/html_node/Commands-For-Completion.html
we remove descriptions for the cases: