DockerCLI/docs/reference/commandline
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
..
attach.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
build.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
checkpoint.md Update most links in docs to use https by default 2021-10-15 15:04:36 +08:00
cli.md tweak description of "docker run" command 2022-04-01 12:28:37 +02:00
commit.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
config.md move orchestration commands to their own section in --help output 2022-04-08 16:55:34 +02:00
config_create.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
config_inspect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
config_ls.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
config_rm.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
container.md tweak description of "docker run" command 2022-04-01 12:28:37 +02:00
container_prune.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
context.md docs: fix (table) formatting, fix some broken links 2022-03-30 15:03:25 +02:00
context_create.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
context_export.md docs: remove deprecated orchestrator flags 2022-02-24 12:28:29 +01:00
context_import.md docs: fix, and touch-up "docker context" docs 2020-05-07 13:53:25 +02:00
context_inspect.md Output compact JSON by default for --format=json 2022-03-15 15:42:35 +01:00
context_ls.md docs: fix (table) formatting, fix some broken links 2022-03-30 15:03:25 +02:00
context_rm.md docs: fix, and touch-up "docker context" docs 2020-05-07 13:53:25 +02:00
context_show.md introduce `context show` command 2022-04-25 14:40:24 +02:00
context_update.md docs: remove deprecated orchestrator flags 2022-02-24 12:28:29 +01:00
context_use.md docs: fix (table) formatting, fix some broken links 2022-03-30 15:03:25 +02:00
cp.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
create.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
diff.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
dockerd.md docs: remove documentation about deprecated cluster-store 2022-05-17 11:00:51 +02:00
events.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
exec.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
export.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
history.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
image.md tweak description of "docker push" and "docker pull" commands 2022-04-01 12:33:05 +02:00
image_prune.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
images.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
import.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
index.md Add stack config command 2022-04-08 14:56:01 +02:00
info.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
inspect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
kill.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
load.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
login.md tweak description of login/logout 2022-04-04 10:44:11 +02:00
logout.md tweak description of login/logout 2022-04-04 10:44:11 +02:00
logs.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
manifest.md tweak description of login/logout 2022-04-04 10:44:11 +02:00
network.md reference docs: fix broken links and markdown touch-ups 2020-04-19 17:13:07 +02:00
network_connect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
network_create.md docs: remove documentation about deprecated cluster-store 2022-05-17 11:00:51 +02:00
network_disconnect.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
network_inspect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
network_ls.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
network_prune.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
network_rm.md Add --force option to network rm subcommand 2022-04-29 13:56:33 +02:00
node.md remove unneeded comment from reference files 2020-03-19 15:15:23 +01:00
node_demote.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
node_inspect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
node_ls.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
node_promote.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
node_ps.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
node_rm.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
node_update.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
pause.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
plugin.md remove unneeded comment from reference files 2020-03-19 15:15:23 +01:00
plugin_create.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
plugin_disable.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
plugin_enable.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
plugin_inspect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
plugin_install.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
plugin_ls.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
plugin_push.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
plugin_rm.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
plugin_set.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
plugin_upgrade.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
port.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
ps.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
pull.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
push.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
rename.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
restart.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
rm.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
rmi.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
run.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
save.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
search.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
secret.md move orchestration commands to their own section in --help output 2022-04-08 16:55:34 +02:00
secret_create.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
secret_inspect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
secret_ls.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
secret_rm.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
service.md move orchestration commands to their own section in --help output 2022-04-08 16:55:34 +02:00
service_create.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
service_inspect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
service_logs.md fix docs, completion and docker service 2020-08-06 17:37:08 +03:00
service_ls.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
service_ps.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
service_rm.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
service_rollback.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
service_scale.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
service_update.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
stack.md move orchestration commands to their own section in --help output 2022-04-08 16:55:34 +02:00
stack_config.md Remove unsupported alias from `docker stack config` help output 2022-04-29 20:18:58 +00:00
stack_deploy.md Add stack config command 2022-04-08 14:56:01 +02:00
stack_ls.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
stack_ps.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
stack_rm.md docs: remove deprecated orchestrator flags 2022-02-24 12:28:29 +01:00
stack_services.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
start.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
stats.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
stop.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
swarm.md remove unneeded comment from reference files 2020-03-19 15:15:23 +01:00
swarm_ca.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
swarm_init.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
swarm_join-token.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
swarm_join.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
swarm_leave.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
swarm_unlock-key.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
swarm_unlock.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
swarm_update.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
system.md remove unneeded comment from reference files 2020-03-19 15:15:23 +01:00
system_df.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
system_events.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
system_prune.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
tag.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
top.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
trust_inspect.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
trust_key_generate.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
trust_key_load.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
trust_revoke.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
trust_sign.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
trust_signer_add.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
trust_signer_remove.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
unpause.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
update.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00
version.md docs: reference: version: add info about API version negotiation 2022-06-02 22:53:23 +02:00
volume.md reference docs: fix broken links and markdown touch-ups 2020-04-19 17:13:07 +02:00
volume_create.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
volume_inspect.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
volume_ls.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
volume_prune.md docs: add anchor-tags for flags 2022-03-30 15:05:29 +02:00
volume_rm.md docs: use "console" code-hint for shell examples 2021-08-21 18:29:13 +02:00
wait.md cli: use custom annotation for aliases 2022-06-28 17:32:09 +02:00