From dd4aa7f0e97f1bcd4e851cefdf16bc9067b7e42a Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Sun, 21 Feb 2016 10:21:28 -0800 Subject: [PATCH] bash completion for `docker update --restart` Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 7757f7d81a..0e441ae734 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -515,6 +515,22 @@ __docker_complete_log_levels() { COMPREPLY=( $( compgen -W "debug info warn error fatal" -- "$cur" ) ) } +__docker_complete_restart() { + case "$prev" in + --restart) + case "$cur" in + on-failure:*) + ;; + *) + COMPREPLY=( $( compgen -W "always no on-failure on-failure: unless-stopped" -- "$cur") ) + ;; + esac + return + ;; + esac + return 1 +} + # a selection of the available signals that is most likely of interest in the # context of docker containers. __docker_complete_signals() { @@ -1657,6 +1673,7 @@ _docker_run() { __docker_complete_log_driver_options && return + __docker_complete_restart && return case "$prev" in --add-host) @@ -1754,16 +1771,6 @@ _docker_run() { esac return ;; - --restart) - case "$cur" in - on-failure:*) - ;; - *) - COMPREPLY=( $( compgen -W "always no on-failure on-failure: unless-stopped" -- "$cur") ) - ;; - esac - return - ;; --security-opt) case "$cur" in label:*:*) @@ -1938,6 +1945,7 @@ _docker_update() { --memory -m --memory-reservation --memory-swap + --restart " local boolean_options=" @@ -1946,6 +1954,8 @@ _docker_update() { local all_options="$options_with_args $boolean_options" + __docker_complete_restart && return + case "$prev" in $(__docker_to_extglob "$options_with_args") ) return