Browse code

Add zsh completion for 'docker daemon --runtimes' and 'docker run --runtime'

Signed-off-by: Steve Durrheimer <s.durrheimer@gmail.com>

Steve Durrheimer authored on 2016/06/21 15:53:10
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
... ...
@@ -933,6 +944,7 @@ __docker_subcommand() {
933 933
         (daemon)
934 934
             _arguments $(__docker_arguments) \
935 935
                 $opts_help \
936
+                "($help)*--add-runtime=[Register an additional OCI compatible runtime]:runtime:__docker_complete_runtimes" \
936 937
                 "($help)--api-cors-header=[CORS headers in the remote API]:CORS headers: " \
937 938
                 "($help)*--authorization-plugin=[Authorization plugins to load]" \
938 939
                 "($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \
... ...
@@ -1251,6 +1263,7 @@ __docker_subcommand() {
1251 1251
                 "($help)--health-timeout=[Maximum time to allow one check to run]:time: " \
1252 1252
                 "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" \
1253 1253
                 "($help)--rm[Remove intermediate containers when it exits]" \
1254
+                "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \
1254 1255
                 "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \
1255 1256
                 "($help)--stop-signal=[Signal to kill a container]:signal:_signals" \
1256 1257
                 "($help)--storage-opt=[Set storage driver options per container]:storage options:->storage-opt" \