mirror of https://github.com/docker/cli.git
f522905595
Previously, the formatter would ignore the quiet option if a custom format was passed; this situation was handled in runPs(), where custom formats would only be applied if the quiet option was not set, but only if the format was set in the CLI's config. This patch updates NewContainerFormat() to do the same, even if a `--format` was passed on the command-line. This is a change in behavior, so may need some discussion; possible alternatives; - produce an error if both `--format` and `--quiet` are passed - print a warning if both are passed (but use the logic from this patch) Before this patch: ```console docker ps --format '{{.Image}}' ubuntu:22.04 alpine docker ps --format '{{.Image}}' --quiet ubuntu:22.04 alpine mkdir -p ~/.docker/ echo '{"psFormat": "{{.Image}}"}' > ~/.docker/config.json docker ps ubuntu:22.04 alpine docker ps --quiet ubuntu:22.04 alpine ``` With this patch applied: ```console docker ps --format '{{.Image}}' ubuntu:22.04 alpine docker ps --format '{{.Image}}' --quiet 40111f61d5c5 482efdf39fac mkdir -p ~/.docker/ echo '{"psFormat": "{{.Image}}"}' > ~/.docker/config.json docker ps ubuntu:22.04 alpine docker ps --quiet 40111f61d5c5 482efdf39fac ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl> |
||
---|---|---|
.. | ||
command | ||
compose | ||
config | ||
connhelper | ||
context | ||
debug | ||
flags | ||
manifest | ||
registry/client | ||
streams | ||
trust | ||
version | ||
winresources | ||
cobra.go | ||
cobra_test.go | ||
error.go | ||
required.go | ||
required_test.go |