c6f0504cf0f75bc17cc422e82fdb84f0c994c461

Author
Abhinav M <abhinavmanchanda@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(docker): add aliases to `docker` plugin (#6527)

Diff

  1diff --git a/plugins/docker/README.md b/plugins/docker/README.md
  2index fab7aa8f15317ff02e9a1076c2300f3a20299ab3..8a88bda48df11a341bf87c8bb051802965469e8d 100644
  3--- a/plugins/docker/README.md
  4+++ b/plugins/docker/README.md
  5@@ -1,6 +1,6 @@
  6 # Docker plugin
  7 
  8-This plugin adds auto-completion for [docker](https://www.docker.com/).
  9+This plugin adds auto-completion and aliases for [docker](https://www.docker.com/).
 10 
 11 To use it add `docker` to the plugins array in your zshrc file.
 12 
 13@@ -28,7 +28,46 @@ the lines below to your zshrc file**, but be aware of the side effects:
 14 >
 15 > Therefore, this behavior is disabled by default. To enable it:
 16 >
 17-> ```
 18+> ```sh
 19 > zstyle ':completion:*:*:docker:*' option-stacking yes
 20 > zstyle ':completion:*:*:docker-*:*' option-stacking yes
 21 > ```
 22+
 23+## Aliases
 24+
 25+| Alias   | Command                     | Description                                                                              |
 26+| :------ | :-------------------------- | :--------------------------------------------------------------------------------------- |
 27+| dbl     | `docker build`              | Build an image from a Dockerfile                                                         |
 28+| dcin    | `docker container inspect`  | Display detailed information on one or more containers                                   |
 29+| dlo     | `docker container logs`     | Fetch the logs of a docker container                                                     |
 30+| dls     | `docker container ls`       | List all the running docker containers                                                   |
 31+| dlsa    | `docker container ls -a`    | List all running and stopped containers                                                  |
 32+| dpo     | `docker container port`     | List port mappings or a specific mapping for the container                               |
 33+| dpu     | `docker pull`               | Pull an image or a repository from a registry                                            |
 34+| dr      | `docker container run`      | Create a new container and start it using the specified command                          |
 35+| drit    | `docker container run -it`  | Create a new container and start it in an interactive shell                              |
 36+| drm     | `docker container rm`       | Remove the specified container(s)                                                        |
 37+| drm!    | `docker container rm -f`    | Force the removal of a running container (uses SIGKILL)                                  |
 38+| dst     | `docker container start`    | Start one or more stopped containers                                                     |
 39+| dstp    | `docker container stop`     | Stop one or more running containers                                                      |
 40+| dtop    | `docker top`                | Display the running processes of a container                                             |
 41+| dxc     | `docker container exec`     | Run a new command in a running container                                                 |
 42+| dxcit   | `docker container exec -it` | Run a new command in a running container in an interactive shell                         |
 43+|         |                             | **Docker Images**                                                                        |
 44+| dib     | `docker image build`        | Build an image from a Dockerfile (same as docker build)                                  |
 45+| dii     | `docker image inspect`      | Display detailed information on one or more images                                       |
 46+| dils    | `docker image ls`           | List docker images                                                                       |
 47+| dip     | `docker image push`         | Push an image or repository to a remote registry                                         |
 48+| dirm    | `docker image rm`           | Remove one or more images                                                                |
 49+| dit     | `docker image tag`          | Add a name and tag to a particular image                                                 |
 50+|         |                             | **Docker Network**                                                                       |
 51+| dnc     | `docker network create`     | Create a new network                                                                     |
 52+| dncn    | `docker network connect`    | Connect a container to a network                                                         |
 53+| dndcn   | `docker network disconnect` | Disconnect a container from a network                                                    |
 54+| dni     | `docker network inspect`    | Return information about one or more networks                                            |
 55+| dnls    | `docker network ls`         | List all networks the engine daemon knows about, including those spanning multiple hosts |
 56+| dnrm    | `docker network rm`         | Remove one or more networks                                                              |
 57+|         |                             | **Docker Volume**                                                                        |
 58+| dvi     | `docker volume inspect`     | Display detailed information about one or more volumes                                   |
 59+| dvls    | `docker volume ls`          | List all the volumes known to  docker                                                    |
 60+| dvprune | `docker volume prune`       | Cleanup dangling volumes                                                                 |
 61diff --git a/plugins/docker/docker.plugin.zsh b/plugins/docker/docker.plugin.zsh
 62new file mode 100644
 63index 0000000000000000000000000000000000000000..1d1ed5f5f8f197d8beb5d09d283412b9741cf2a9
 64--- /dev/null
 65+++ b/plugins/docker/docker.plugin.zsh
 66@@ -0,0 +1,39 @@
 67+alias dbl='docker build'
 68+alias dpu='docker pull'
 69+alias dtop='docker top'
 70+
 71+# docker containers
 72+alias dcin='docker container inspect'
 73+alias dlo='docker container logs'
 74+alias dls='docker container ls'
 75+alias dlsa='docker container ls -a'
 76+alias dpo='docker container port'
 77+alias dr='docker container run'
 78+alias drit='docker container run -it'
 79+alias drm='docker container rm'
 80+alias 'drm!'='docker container rm -f'
 81+alias dst='docker container start'
 82+alias dstp='docker container stop'
 83+alias dxc='docker container exec'
 84+alias dxcit='docker container exec -it'
 85+
 86+# docker images
 87+alias dib='docker image build'
 88+alias dii='docker image inspect'
 89+alias dils='docker image ls'
 90+alias dip='docker image push'
 91+alias dirm='docker image rm'
 92+alias dit='docker image tag'
 93+
 94+# docker network
 95+alias dnc='docker network create'
 96+alias dncn='docker network connect'
 97+alias dndcn='docker network disconnect'
 98+alias dni='docker network inspect'
 99+alias dnls='docker network ls'
100+alias dnrm='docker network rm'
101+
102+# docker volume
103+alias dvi='docker volume inspect'
104+alias dvls='docker volume ls'
105+alias dvprune='docker volume prune'