-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Enable shell completion for podman commands. #4768
Conversation
Hi @NevilleC. Thanks for your PR. I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
WIP - just opening it to show I would like to take #3878. It seems to work but it needs to be refined. Feel free to review but keep this in mind, please. example: [~]$ podman lo[tab][tab]
load login logout logs I hope this is OK. Update to come:
|
/ok-to-test |
bdb7190
to
7933bfe
Compare
371dd76
to
27691ab
Compare
27691ab
to
f8065c8
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: NevilleC, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@NevilleC Is there a way to further enhance this to add some existing options.
|
I'd like Ed to take a look at the zsh work before we merge. On the whole, I really like doing this automatically, maintaining the completions manually is really easy to mess up (I can't guarantee we've always caught PRs that added flags, but no completions) |
I'm really sorry but there is no way I will approve this. The entire point of my zsh completion is for it to be simple, clean, and hands-off: all the completion code generates itself based on the output of |
We could probably automate a check during PR testing similar to how we do gofmt - run the regeneration command, fail if the git repo is unclean. |
e9f908e
to
74101f0
Compare
@rhatdan Maybe, I'd need to search for this (maybe something like https://github.com/spf13/cobra/blob/master/bash_completions.md#specify-custom-flag-completion). @edsantiago No problem, I do understand your point of view. What I liked with this approach is that the user does not really need to update the Maybe we could keep this approach only for @mheon @edsantiago Let me know in which direction you want to go and I will update/close accordingly this PR. |
☔ The latest upstream changes (presumably #4781) made this pull request unmergeable. Please resolve the merge conflicts. |
To be fair, I can't handle that in zsh right now either. If the - --events-backend string Events backend to use
+ --events-backend string Events backend to use: file, journald, or none ...then it would be pretty straightforward to parse that and add those as options. (Or I could just hardcode them directly into the zsh completion script. But as you might guess, I won't do that).
@NevilleC the zsh completion script does not need to be touched. What I was trying to say earlier is that it autogenerates completions. When a user hits TAB, the completion script runs
I'm ok with that. |
@edsantiago I like the idea of specifying the options in the help. --events. ... (Valures: journald, file, none) Something like: |
I don't like the manually-maintained aspect, but I love the consistency of the format. I'd love to see that in place. |
I added a command completion that generates the bash script that would enable the shell completion, using the cobra function GenBashCompletion. Closes containers#3878 Signed-off-by: Neville Cain <[email protected]>
74101f0
to
4ce5e0e
Compare
/retest |
☔ The latest upstream changes (presumably #4817) made this pull request unmergeable. Please resolve the merge conflicts. |
@NevilleC: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@rhatdan @edsantiago @mheon shall I rebase or close this MR as I am not sure it is something wanted anymore? Please let me know. |
@NevilleC I've looked at the current bash completion, and at the new cobra-generated one, and I lean strongly toward keeping the existing one for now, with the hope that some bashcompletionese speaker will be able to bring in the figure-things-out-automatically |
The loss of autocomplete for container/image names could be a dealbreaker. I don't know if that would be supported in this configuration. |
Right the big advance would be a way to merge the two together. IE Have a library of calls that exists for greater expansion, perhaps in a separate bash script and then have the autogenerated parts. But this would require some real expertise and creativity in bash to make it work, I believe. Sadly if this was easy, I would figure people using cobra would be pointing it out. |
Thanks for the feedback. Closing the PR. |
I added a command completion that generates
the shell scripts that would enable the shell
completion, using the cobra function
GenBash/ZshCompletion
.Closes #3878
Signed-off-by: Neville Cain [email protected]