This commit is contained in:
Sebastian Mark 2018-11-15 13:06:10 +01:00
commit 5179d46d47
3 changed files with 33 additions and 0 deletions

10
README.md Normal file
View file

@ -0,0 +1,10 @@
# docker-enter zsh plugin
add the alias `docker-enter` to enter an existing container.
Container names will be tab-completed.
## Installation
### Antigen
`antigen bundle https://gitlab.com/smark/docker-enter.zshplugin.git`

View file

@ -0,0 +1,13 @@
#compdef docker-enter
_docker-enter() {
local state
_arguments -C '1: :->container' '2: :->shell'
case $state in
(container) compadd -- $(docker ps --format '{{.Names}}');;
(shell) compadd -P /bin/ -- bash sh;;
esac
}
_docker-enter "$@"

10
docker-enter.plugin.zsh Normal file
View file

@ -0,0 +1,10 @@
#! /bin/zsh
## Author: Sebastian Mark
## CC-BY-SA (https://creativecommons.org/licenses/by-sa/4.0/deed.de)
## for civil use only
docker-enter() {
docker exec -it $1 ${2:-"/bin/bash"}
}