浏览代码

Merge pull request #3424 from bergvandenp/docker_exec

added exec command to docker plugin
Robby Russell 10 年之前
父节点
当前提交
5167450ef9
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      plugins/docker/_docker

+ 12 - 0
plugins/docker/_docker

@@ -4,6 +4,7 @@
 # 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
@@ -238,6 +239,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 ---------
 # ----------------------
 
@@ -276,6 +285,7 @@ _1st_arguments=(
     "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'
@@ -353,4 +363,6 @@ case "$words[1]" in
         __version ;;
     wait)
         __wait ;;
+    exec)
+        __exec ;;
 esac