c74f2a1be980c60d937046364db0c9497187457a

Author
Tjark <16938041+tjarbo@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(podman): add plugin (#11695)

Closes #7489
Closes #9721

Diff

  1diff --git a/plugins/podman/README.md b/plugins/podman/README.md
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..99daa28cde1b506bcf41c1874ad3e2a6cf7b3bae
  4--- /dev/null
  5+++ b/plugins/podman/README.md
  6@@ -0,0 +1,47 @@
  7+# Podman plugin
  8+
  9+This plugin adds auto-completion and aliases for [podman](https://podman.io/).
 10+
 11+To use it add `podman` to the plugins array in your zshrc file.
 12+
 13+```zsh
 14+plugins=(... podman)
 15+```
 16+
 17+## Aliases
 18+
 19+| Alias   | Command                                       | Description                                                                              |
 20+| :------ | :-------------------------------------------- | :--------------------------------------------------------------------------------------- |
 21+| pbl     | `podman build`                                | Build an image from a Dockerfile                                                         |
 22+| pcin    | `podman container inspect`                    | Display detailed information on one or more containers                                   |
 23+| pcls    | `podman container ls`                         | List all the running podman containers                                                   |
 24+| pclsa   | `podman container ls --all`                   | List all running and stopped containers                                                  |
 25+| pib     | `podman image build`                          | Build an image from a Dockerfile (same as podman build)                                  |
 26+| pii     | `podman image inspect`                        | Display detailed information on one or more images                                       |
 27+| pils    | `podman image ls`                             | List podman images                                                                       |
 28+| pipu    | `podman image push`                           | Push an image or repository to a remote registry                                         |
 29+| pirm    | `podman image rm`                             | Remove one or more images                                                                |
 30+| pit     | `podman image tag`                            | Add a name and tag to a particular image                                                 |
 31+| plo     | `podman container logs`                       | Fetch the logs of a podman container                                                     |
 32+| pnc     | `podman network create`                       | Create a new network                                                                     |
 33+| pncn    | `podman network connect`                      | Connect a container to a network                                                         |
 34+| pndcn   | `podman network disconnect`                   | Disconnect a container from a network                                                    |
 35+| pni     | `podman network inspect`                      | Return information about one or more networks                                            |
 36+| pnls    | `podman network ls`                           | List all networks the engine daemon knows about, including those spanning multiple hosts |
 37+| pnrm    | `podman network rm`                           | Remove one or more networks                                                              |
 38+| ppo     | `podman container port`                       | List port mappings or a specific mapping for the container                               |
 39+| ppu     | `podman pull`                                 | Pull an image or a repository from a registry                                            |
 40+| pr      | `podman container run`                        | Create a new container and start it using the specified command                          |
 41+| prit    | `podman container run --interactive --tty`    | Create a new container and start it in an interactive shell                              |
 42+| prm     | `podman container rm`                         | Remove the specified container(s)                                                        |
 43+| prm!    | `podman container rm --force`                 | Force the removal of a running container (uses SIGKILL)                                  |
 44+| pst     | `podman container start`                      | Start one or more stopped containers                                                     |
 45+| prs     | `podman container restart`                    | Restart one or more containers                                                           |
 46+| psta    | `podman stop $(podman ps -q)`                 | Stop all running containers                                                              |
 47+| pstp    | `podman container stop`                       | Stop one or more running containers                                                      |
 48+| ptop    | `podman top`                                  | Display the running processes of a container                                             |
 49+| pvi     | `podman volume inspect`                       | Display detailed information about one or more volumes                                   |
 50+| pvls    | `podman volume ls`                            | List all the volumes known to podman                                                     |
 51+| pvprune | `podman volume prune`                         | Cleanup dangling volumes                                                                 |
 52+| pxc     | `podman container exec`                       | Run a new command in a running container                                                 |
 53+| pxcit   | `podman container exec --interactive --tty`   | Run a new command in a running container in an interactive shell                         |
 54diff --git a/plugins/podman/podman.plugin.zsh b/plugins/podman/podman.plugin.zsh
 55new file mode 100644
 56index 0000000000000000000000000000000000000000..97cf92b2a5f6dc72c0547b09cc72b1bd92730602
 57--- /dev/null
 58+++ b/plugins/podman/podman.plugin.zsh
 59@@ -0,0 +1,47 @@
 60+if (( ! $+commands[podman] )); then
 61+  return
 62+fi
 63+
 64+# If the completion file doesn't exist yet, we need to autoload it and
 65+# bind it to `podman`. Otherwise, compinit will have already done that.
 66+if [[ ! -f "$ZSH_CACHE_DIR/completions/_podman" ]]; then
 67+  typeset -g -A _comps
 68+  autoload -Uz _podman
 69+  _comps[podman]=_podman
 70+fi
 71+
 72+podman completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_podman" &|
 73+
 74+alias pbl='podman build'
 75+alias pcin='podman container inspect'
 76+alias pcls='podman container ls'
 77+alias pclsa='podman container ls --all'
 78+alias pib='podman image build'
 79+alias pii='podman image inspect'
 80+alias pils='podman image ls'
 81+alias pipu='podman image push'
 82+alias pirm='podman image rm'
 83+alias pit='podman image tag'
 84+alias plo='podman container logs'
 85+alias pnc='podman network create'
 86+alias pncn='podman network connect'
 87+alias pndcn='podman network disconnect'
 88+alias pni='podman network inspect'
 89+alias pnls='podman network ls'
 90+alias pnrm='podman network rm'
 91+alias ppo='podman container port'
 92+alias ppu='podman pull'
 93+alias pr='podman container run'
 94+alias prit='podman container run --interactive --tty'
 95+alias prm='podman container rm'
 96+alias 'prm!'='podman container rm --force'
 97+alias pst='podman container start'
 98+alias prs='podman container restart'
 99+alias psta='podman stop $(podman ps --quiet)'
100+alias pstp='podman container stop'
101+alias ptop='podman top'
102+alias pvi='podman volume inspect'
103+alias pvls='podman volume ls'
104+alias pvprune='podman volume prune'
105+alias pxc='podman container exec'
106+alias pxcit='podman container exec --interactive --tty'