DockerCLI/cli/command/system
Sebastiaan van Stijn 80b1285fec cli: use custom annotation for aliases
Cobra allows for aliases to be defined for a command, but only allows these
to be defined at the same level (for example, `docker image ls` as alias for
`docker image list`). Our CLI has some commands that are available both as a
top-level shorthand as well as `docker <object> <verb>` subcommands. For example,
`docker ps` is a shorthand for `docker container ps` / `docker container ls`.

This patch introduces a custom "aliases" annotation that can be used to print
all available aliases for a command. While this requires these aliases to be
defined manually, in practice the list of aliases rarely changes, so maintenance
should be minimal.

As a convention, we could consider the first command in this list to be the
canonical command, so that we can use this information to add redirects in
our documentation in future.

Before this patch:

    docker images --help

    Usage:  docker images [OPTIONS] [REPOSITORY[:TAG]]

    List images

    Options:
      -a, --all             Show all images (default hides intermediate images)
      ...

With this patch:

    docker images --help

    Usage:  docker images [OPTIONS] [REPOSITORY[:TAG]]

    List images

    Aliases:
      docker image ls, docker image list, docker images

    Options:
      -a, --all             Show all images (default hides intermediate images)
      ...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-06-28 17:32:09 +02:00
..
testdata info: update plugin section to show installed path 2022-06-01 12:46:07 +02:00
client_test.go Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
cmd.go Revert "Disable `docker system dial-stdio` on Windows" 2019-03-12 14:57:52 +00:00
df.go Adopt Cobra completion v2 to support completion by CLI plugins 2022-05-12 12:59:10 +02:00
dial_stdio.go Adopt Cobra completion v2 to support completion by CLI plugins 2022-05-12 12:59:10 +02:00
events.go cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
info.go cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
info_test.go info: remove cluster store from docker info output 2022-05-17 11:01:49 +02:00
inspect.go Output compact JSON by default for --format=json 2022-03-15 15:42:35 +01:00
prune.go Adopt Cobra completion v2 to support completion by CLI plugins 2022-05-12 12:59:10 +02:00
prune_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-23 00:28:55 +01:00
version.go Adopt Cobra completion v2 to support completion by CLI plugins 2022-05-12 12:59:10 +02:00
version_test.go remove "Experimental" client field from "docker version" 2022-04-08 15:48:00 +02:00