13 lines
248 B
Bash
13 lines
248 B
Bash
#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 "$@"
|