-
Notifications
You must be signed in to change notification settings - Fork 2k
cli: disable file-completion by default #6447
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
Conversation
This uses the DefaultShellCompDirective feature which was added in cobra to override the default (which would complete to use files for commands and flags). Note that we set "cobra.NoFileCompletions" for many commands, which is redundant with this change, so we could remove as well. Signed-off-by: Sebastiaan van Stijn <[email protected]>
This uses the DefaultShellCompDirective feature which was added in cobra to override the default (which would complete to use files for commands and flags). Signed-off-by: Sebastiaan van Stijn <[email protected]>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
FWIW; this would allow us to remove uses of Line 35 in c5467b5
I also considered adding a |
cc @crazy-max @ndeloof in case buildx or compose depends on the behavior to complete with filenames (for both commands and flags); I put the "disable for plugins" as a separate commit. |
@thaJeztah For flags/cmds that need file completion in cli plugins I guess it needs follow-ups to opt-in with this implementation? |
Yes, probably; we can try when I update my PR that vendors the latest from master. Currently the default is that any flag and any command that doesn't have completion configured will default to completing based on the filesystem; in MOST cases that's not desirable; for example, with buildx; docker buildx build --platform<tab>
AUTHORS codecov.yml docs/ LICENSE README.md version/
bake/ commands/ driver/ localstate/ store/
bin/ controller/ foo/ MAINTAINERS tests/
... With this option set, the above will just "not provide completion", but of course some commands do want completion for files (or directories, or files with a specific extension), so for those, it will have to be explicitly enabled. FWIW, I was considering adding a |
run
andcreate
#5580cli: disable file-completion by default
This uses the DefaultShellCompDirective feature which was added
in cobra to override the default (which would complete to use
files for commands and flags).
cli-plugins: disable file-completion by default
This uses the DefaultShellCompDirective feature which was added
in cobra to override the default (which would complete to use
files for commands and flags).
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)