Genesis
This commit is contained in:
commit
5179d46d47
3 changed files with 33 additions and 0 deletions
10
README.md
Normal file
10
README.md
Normal 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`
|
13
_docker-enter-completion.zsh
Normal file
13
_docker-enter-completion.zsh
Normal 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
10
docker-enter.plugin.zsh
Normal 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"}
|
||||
}
|
||||
|
Loading…
Reference in a new issue