-
Notifications
You must be signed in to change notification settings - Fork 844
WIP: switch to automatically-generated completions #6207
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
base: main
Are you sure you want to change the base?
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.
LGTM @Luap99 might want to take a quick look at this one.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, nalind 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 |
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 have not tested it yet but I assume we would like to add some autocompletion functions to auto complete container/image names at least for the basic commands.
Otherwise we regress users compared to the existing bash script.
Makefile
Outdated
|
||
.PHONY: install.completions | ||
install.completions: | ||
install.completions: contrib/completions/bash/buildah |
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.
this should install for zsh and fish as well, see the podman Makefile for an example
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.
Adding.
contrib/completions/fish/buildah
Outdated
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.
In hindsight I think committing the files in podman was a mistake, every cobra update that changes the files will means you need to regenerate so that auto renovate updates won't work.
So in short I don't think we should commit these completion files at all since the build process is generating them anyway,
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.
Fair enough. I'll drop them.
Also I guess this should have a Fixes #6069? |
Ok I did some local tests I think we might one to port some other changes from podman such as
Because the are persistent flags they can be set technically anywhere but realistically for a user suggesting them on each command makes no sense. I am happy to take that over if you don't want to spend the time understanding all the small details in play here, its something I can do while being offline on the train next week. |
If you want to, sure, otherwise I could stand to get more familiar with those bits. |
Ephemeral COPR build failed. @containers/packit-build please check. |
Get out of business of manually crafting and updating shell completion helper functions. Signed-off-by: Nalin Dahyabhai <[email protected]>
/retitle WIP: switch to automatically-generated completions |
I find other stuff to do, if you want to have some deeper understanding please do that. https://github.com/containers/podman/blob/badf6b8b1735dff7cdb45636eb8eba490454f9d9/cmd/podman/root.go#L302-L321 For actual specific completion suggestions there is https://github.com/containers/podman/blob/badf6b8b1735dff7cdb45636eb8eba490454f9d9/cmd/podman/common/completion.go with a ton of example functions. Than you just have to register them to the command via ValidArgsFunction or in case of flags RegisterFlagCompletionFunc(), |
And for testing with bash The nice thing about the binary is generating the completions is if you build buildah from source and let's say added a new command then it will work right away without having to reload the script, |
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-sigs/prow repository. |
A friendly reminder that this PR had no activity for 30 days. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Get out of business of manually crafting and updating shell completion helper functions.
Fixes #6069
How to verify it
I don't use a shell that benefits from this (old habit), but if you do,
source
the new file and see if it works?Which issue(s) this PR fixes:
None
Special notes for your reviewer:
Does this PR introduce a user-facing change?