diff options
Diffstat (limited to 'plugins/docker/_docker')
-rw-r--r-- | plugins/docker/_docker | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/plugins/docker/_docker b/plugins/docker/_docker index c291037a3..aadc9c61d 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -4,13 +4,14 @@ # Requires: Docker installed # Author: Azaan (@aeonazaan) # Updates: Bob Maerten (@bobmaerten) for Docker v0.9+ +# Paul van den Berg (@bergvandenp) for Docker v1.3+ # ----- Helper functions # Output a selectable list of all running docker containers __docker_containers() { declare -a cont_cmd - cont_cmd=($(docker ps | awk 'NR>1{print $1":[CON("$1")"$2"("$3")]"}')) + cont_cmd=($(docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}')) _describe 'containers' cont_cmd } @@ -214,7 +215,11 @@ __save() { __start() { _arguments \ '(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \ - '(-i,--interactive=)'{-i, --interactive=}'[Attach container''s stdin]' + '(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]' + __docker_containers +} + +__stats() { __docker_containers } @@ -238,6 +243,14 @@ __wait() { __docker_containers } +__exec() { + _arguments \ + '(-d,--detach=)'{-d,--detach=}'[Detached mode: run command in the background]' \ + '(-i,--interactive=)'{-i,--interactive=}'[Keep STDIN open even if not attached]' \ + '(-t,--tty=)'{-t,--tty=}'[Allocate a pseudo-TTY]' + __docker_containers +} + # end commands --------- # ---------------------- @@ -271,11 +284,13 @@ _1st_arguments=( "save":"Save an image to a tar archive" "search":"Search for an image in the docker index" "start":"Start a stopped container" + "stats":"Display a live stream of one or more containers' resource usage statistics" "stop":"Stop a running container" "tag":"Tag an image into a repository" "top":"Lookup the running processes of a container" "version":"Show the docker version information" "wait":"Block until a container stops, then print its exit code" + "exec":"Run a task inside a running container" ) _arguments '*:: :->command' @@ -341,6 +356,8 @@ case "$words[1]" in __save ;; search) __search ;; + stats) + __stats ;; start) __start ;; stop) @@ -353,4 +370,6 @@ case "$words[1]" in __version ;; wait) __wait ;; + exec) + __exec ;; esac |