DockerCLI/cli/command/container/testdata
Sebastiaan van Stijn f522905595
docker ps: always use --quiet, also combined with --format
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>
2023-04-10 01:12:00 +02:00
..
container-create-localhost-dns-ipv6.golden Fix warnings not being printed on "create", only on "run" 2018-12-13 14:21:34 +01:00
container-create-localhost-dns.golden Fix warnings not being printed on "create", only on "run" 2018-12-13 14:21:34 +01:00
container-create-oom-kill-true-without-memory-limit.golden Fix warnings not being printed on "create", only on "run" 2018-12-13 14:21:34 +01:00
container-create-oom-kill-without-memory-limit.golden Fix warnings not being printed on "create", only on "run" 2018-12-13 14:21:34 +01:00
container-list-format-name-name.golden Add unit tests to docker container ls 2018-02-19 11:22:36 +01:00
container-list-format-with-arg.golden Add unit tests to docker container ls 2018-02-19 11:22:36 +01:00
container-list-quiet.golden docker ps: always use --quiet, also combined with --format 2023-04-10 01:12:00 +02:00
container-list-with-config-format.golden Fix psFormat's Size handling in config file 2022-06-07 12:48:56 +02:00
container-list-with-format.golden Add unit tests to docker container ls 2018-02-19 11:22:36 +01:00
container-list-without-format-no-trunc.golden Fix flaky TestContainerList tests 2022-03-28 20:37:06 +02:00
container-list-without-format.golden Fix flaky TestContainerList tests 2022-03-28 20:37:06 +02:00
container-port-all-ports.golden cli/command/container: runPort: sort ports before printing 2022-12-01 10:58:40 +01:00
container-port-ipv4.golden Use net.JoinHostPort() to fix formatting with IPv6 addresses 2021-04-20 11:05:24 +02:00
container-port-ipv6-and-ipv4-443-udp.golden cli/command/container: runPort: sort ports before printing 2022-12-01 10:58:40 +01:00
container-port-ipv6-and-ipv4.golden cli/command/container: runPort: sort ports before printing 2022-12-01 10:58:40 +01:00
container-port-ipv6.golden Use net.JoinHostPort() to fix formatting with IPv6 addresses 2021-04-20 11:05:24 +02:00
utf8.env Import docker/docker/cli 2017-04-17 17:40:59 -04:00
utf16.env Import docker/docker/cli 2017-04-17 17:40:59 -04:00
utf16be.env Import docker/docker/cli 2017-04-17 17:40:59 -04:00
valid.env Import docker/docker/cli 2017-04-17 17:40:59 -04:00
valid.label Import docker/docker/cli 2017-04-17 17:40:59 -04:00