images: print hint when invoking "docker images" with ambiguous argument by thaJeztah · Pull Request #4849 · docker/cli (original) (raw)

cli/command/images: runImages: inline intermediate var

cli/command/images: runImages: use proper camel-case for dockerCLI

images: print hint when invoking "docker images" with ambiguous argument

The docker images top-level subcommand predates the docker <object> <verb>
convention (e.g. docker image ls), but accepts a positional argument to
search/filter images by name (globbing). It's common for users to accidentally
mistake these commands, and to use (e.g.) docker images ls, expecting
to see all images, but ending up with an empty list because no image named
"ls" was found.

Disallowing these search-terms would be a breaking change, but we can print
and informational message to help the users correct their mistake.

Before this patch:

docker images ls
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

With this patch applied:

docker images ls
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

No images found matching "ls": did you mean "docker image ls"?

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

print hint when invoking "docker images" with ambiguous argument