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> |
||
---|---|---|
.. | ||
builder | ||
checkpoint | ||
commands | ||
completion | ||
config | ||
container | ||
context | ||
formatter | ||
idresolver | ||
image | ||
inspect | ||
manifest | ||
network | ||
node | ||
plugin | ||
registry | ||
secret | ||
service | ||
stack | ||
swarm | ||
system | ||
task | ||
testdata | ||
trust | ||
volume | ||
cli.go | ||
cli_options.go | ||
cli_options_test.go | ||
cli_test.go | ||
context.go | ||
context_test.go | ||
defaultcontextstore.go | ||
defaultcontextstore_test.go | ||
events_utils.go | ||
registry.go | ||
registry_test.go | ||
streams.go | ||
trust.go | ||
utils.go | ||
utils_test.go |