mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Add docker-enter plugin
This commit is contained in:
parent
e55c715508
commit
1982ce8a55
1 changed files with 25 additions and 0 deletions
25
plugins/docker-enter/docker-enter.plugin.zsh
Normal file
25
plugins/docker-enter/docker-enter.plugin.zsh
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# docker-enter autocompletion zsh
|
||||||
|
# Author: Antonio Murdaca <me@runcom.ninja>
|
||||||
|
|
||||||
|
local curcontext=$curcontext state line
|
||||||
|
declare -A opt_args
|
||||||
|
|
||||||
|
_docker_running_containers() {
|
||||||
|
compadd "$@" $(docker ps | perl -ne '@cols = split /\s{2,}/, $_; printf "%20s\n", $cols[6]' | tail -n +3 | awk '$1' | xargs)
|
||||||
|
}
|
||||||
|
|
||||||
|
_docker_enter () {
|
||||||
|
local curcontext="$curcontext" state line
|
||||||
|
typeset -A opt_args
|
||||||
|
|
||||||
|
_arguments '1: :->command'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
command) _docker_running_containers ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
compdef _docker_enter docker-enter
|
||||||
Loading…
Add table
Add a link
Reference in a new issue