Browse code

Merge pull request #24276 from sdurrheimer/zsh-completion-daemon-add-runtime

Add zsh completion for 'docker daemon --runtimes' and 'docker run --r…

Antonio Murdaca authored on 2016/07/04 21:40:56
Showing 1 changed files
... ...
@@ -299,6 +299,17 @@ __docker_complete_pid() {
299 299
     return ret
300 300
 }
301 301
 
302
+__docker_complete_runtimes() {
303
+    [[ $PREFIX = -*  ]] && return 1
304
+    integer ret=1
305
+
306
+    emulate -L zsh
307
+    setopt extendedglob
308
+    local -a runtimes_opts
309
+    runtimes_opts=(${(ps: :)${(f)${${"$(_call_program commands docker $docker_options info)"##*$'\n'Runtimes: }%%$'\n'^ *}}})
310
+    _describe -t runtimes-opts "runtimes options" runtimes_opts && ret=0
311
+}
312
+
302 313
 __docker_complete_ps_filters() {
303 314
     [[ $PREFIX = -* ]] && return 1
304 315
     integer ret=1
... ...
@@ -1296,6 +1307,7 @@ __docker_subcommand() {
1296 1296
         (daemon)
1297 1297
             _arguments $(__docker_arguments) \
1298 1298
                 $opts_help \
1299
+                "($help)*--add-runtime=[Register an additional OCI compatible runtime]:runtime:__docker_complete_runtimes" \
1299 1300
                 "($help)--api-cors-header=[CORS headers in the remote API]:CORS headers: " \
1300 1301
                 "($help)*--authorization-plugin=[Authorization plugins to load]" \
1301 1302
                 "($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \
... ...
@@ -1648,6 +1660,7 @@ __docker_subcommand() {
1648 1648
                 "($help)--health-timeout=[Maximum time to allow one check to run]:time: " \
1649 1649
                 "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" \
1650 1650
                 "($help)--rm[Remove intermediate containers when it exits]" \
1651
+                "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \
1651 1652
                 "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \
1652 1653
                 "($help)--stop-signal=[Signal to kill a container]:signal:_signals" \
1653 1654
                 "($help)--storage-opt=[Set storage driver options per container]:storage options:->storage-opt" \