Open thaJeztah opened 5 days ago
Attention: Patch coverage is 58.13953%
with 18 lines
in your changes missing coverage. Please review.
Project coverage is 61.52%. Comparing base (
cfbf88f
) to head (0e18564
).
Ah! Forgot to remove something I previously used. Also looks like we're running some deprecated linters
#16 0.209 level=warning msg="[lintersdb] The linter named \"megacheck\" is deprecated. It has been split into: gosimple, staticcheck, unused."
#16 0.209 level=warning msg="[lintersdb] The name \"vet\" is deprecated. The linter has been renamed to: govet."
#16 65.71 cli/command/completion/functions.go:123:2: ineffectual assignment to toComplete (ineffassign)
#16 65.71 toComplete = strings.ToLower(toComplete)
#16 65.71 ^
Thanks for reviewing! I'll have a look at fixing the typo when I'm near my computer.
Also; wrt the "disable descriptions" https://github.com/docker/cli/pull/5238#discussion_r1666894131 it looks like buildx DOES enable them for its completion, so maybe we should enable it in our code as well; there may be some commands that could use a slight touch-up for those as some have descriptions that are a bit confusing, so still best to do in a follow up
cli/command/completion: add FileNames utility
This is just a convenience function to allow defining completion to use the default (complete with filenames and directories).
cli/command/completion: add EnvVarNames utility
EnvVarNames offers completion for environment-variable names. This completion can be used for "--env" and "--build-arg" flags, which allow obtaining the value of the given environment-variable if present in the local environment, so we only should complete the names of the environment variables, and not their value. This also prevents the completion script from printing values of environment variables containing sensitive values.
For example;
Before this patch:
With this patch:
cli/command/completion: add FromList utility
It's an alias for cobra.FixedCompletions but takes a variadic list of strings, so that it's not needed to construct an array for this.
cli/command/container: provide flag-completion for "docker create"
"docker run" and "docker create" are mostly identical, so we can copy the same completion functions,
We could possibly create a utility for this (similar to
addFlags()
which configures both commands with the flags they share). I considered combining his withaddFlags()
, but that utility is also used in various tests, in which we don't need this feature, so keeping that for a future exercise.cmd/docker: fix completion for --context
registerCompletionFuncForGlobalFlags was called from newDockerCommand, at which time no context-store is initialized yet, so it would return a nil value, probably resulting in
store.Names
to panic, but these errors are not shown when running the completion. As a result, the flag completion would fall back to completing from filenames.This patch changes the function to dynamically get the context-store; this fixes the problem mentioned above, because at the time the completion function is invoked, the CLI is fully initialized, and does have a context-store available.
A (non-exported) interface is defined to allow the function to accept alternative implementations (not requiring a full command.DockerCLI).
Before this patch:
With this patch:
cli/context/store: Names(): fix panic when called with nil-interface
Before this, it would panic when a nil-interface was passed.
cli/command/container: add completion for --cap-add, --cap-drop
With this patch:
cli/command/container: add completion for --restart
With this patch:
cli/command/container: add completion for --volumes-from
With this patch:
cli/command/container: add completion for --stop-signal
With this patch:
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)