Skip to content

Commit

Permalink
Add abbreviations not available in Oh My ZSH's Docker plugin (#1)
Browse files Browse the repository at this point in the history
- add `ddrmi` abbreviation
- add `dps` and `dpsa` abbreviations
  • Loading branch information
Asim-Tahir authored Jan 13, 2024
2 parents 4ea628c + ebe05fa commit e6d789f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ abbr --show | grep dstopa

### Image

| Abbreviation | Command |
| ------------ | ---------------------- |
| `dib` | `docker image build` |
| `dii` | `docker image inspect` |
| `dils` | `docker image ls` |
| `dis` | `docker images` |
| `dipu` | `docker image push` |
| `dirm` | `docker image rm` |
| `dit` | `docker image tag` |
| Abbreviation | Command |
| ------------ | ---------------------------- |
| `dib` | `docker image build` |
| `dii` | `docker image inspect` |
| `dils` | `docker image ls` |
| `dis` | `docker images` |
| `dipu` | `docker image push` |
| `dirm` | `docker image rm` |
| `ddrmi` | remove all unused images[^1] |
| `dit` | `docker image tag` |

### Container

Expand All @@ -53,6 +54,8 @@ abbr --show | grep dstopa
| `dcin` | `docker container inspect` |
| `dcls` | `docker container ls` |
| `dclsa` | `docker container ls -a` |
| `dps` | `docker ps` |
| `dpsa` | `docker ps -a` |
| `dlo` | `docker container logs` |
| `dpo` | `docker container port` |
| `dr` | `docker container run` |
Expand Down Expand Up @@ -88,9 +91,9 @@ abbr --show | grep dstopa

| Abbreviation | Command |
| ------------ | ------------------------------- |
| `dpl`[^1] | `docker pull` |
| `dpl`[^2] | `docker pull` |
| `dbl` | `docker build` |
| `dstopa`[^2] | stop all running containers[^3] |
| `dstopa`[^3] | stop all running containers[^4] |
| `dtop` | `docker top` |

# Credit
Expand All @@ -110,6 +113,7 @@ Base structure heavily inspired from [`jhillyerd/plugin-git`](https://github.com
[fisher]: https://github.com/jorgebucaran/fisher
[license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square

[^1]: The original abbreviation in [`Oh My Zsh`][omz]'s [Docker plugin][omz-docker-plugin] for the `docker pull` command is [`dpu`](https://github.com/ohmyzsh/ohmyzsh/blob/7d5e12500a2ba0b575ffafcbb516568973528730/plugins/docker/docker.plugin.zsh#L19) but renamed as `dpl` is more meaningful.
[^2]: The original abbreviation in [`Oh My Zsh`][omz]'s [Docker plugin][omz-docker-plugin] for the `docker stop (docker ps -q)` command is [`dsta`](https://github.com/ohmyzsh/ohmyzsh/blob/7d5e12500a2ba0b575ffafcbb516568973528730/plugins/docker/docker.plugin.zsh#L26C7-L26C11) but renamed as `dstopa` is more meaningful.
[^3]: `docker stop (docker ps -q)` command stops all running containers.
[^1]: `docker rmi (docker images --filter "dangling=true" -q --no-trunc)` command removes all dangling images, which are untagged images that are not referenced by any container.
[^2]: The original abbreviation in [`Oh My Zsh`][omz]'s [Docker plugin][omz-docker-plugin] for the `docker pull` command is [`dpu`](https://github.com/ohmyzsh/ohmyzsh/blob/7d5e12500a2ba0b575ffafcbb516568973528730/plugins/docker/docker.plugin.zsh#L19) but renamed as `dpl` is more meaningful.
[^3]: The original abbreviation in [`Oh My Zsh`][omz]'s [Docker plugin][omz-docker-plugin] for the `docker stop (docker ps -q)` command is [`dsta`](https://github.com/ohmyzsh/ohmyzsh/blob/7d5e12500a2ba0b575ffafcbb516568973528730/plugins/docker/docker.plugin.zsh#L26C7-L26C11) but renamed as `dstopa` is more meaningful.
[^4]: `docker stop (docker ps -q)` command stops all running containers.
3 changes: 3 additions & 0 deletions functions/_docker.abbrs.fish
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ function _docker.abbrs -d "Initialize Docker abbreviations"
abbr -a -g dis docker images
abbr -a -g dipu docker image push
abbr -a -g dirm docker image rm
abbr -a -g ddrmi 'docker rmi (docker images --filter "dangling=true" -q --no-trunc)' # remove all unused images
abbr -a -g dit docker image tag

# Container
abbr -a -g dcin docker container inspect
abbr -a -g dcls docker container ls
abbr -a -g dclsa docker container ls -a
abbr -a -g dps docker ps
abbr -a -g dpsa docker ps -a
abbr -a -g dlo docker container logs
abbr -a -g dpo docker container port
abbr -a -g dr docker container run
Expand Down

0 comments on commit e6d789f

Please sign in to comment.