From f50f5f89443530e2dc95cc145dc2b360e76c5e3d Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Mon, 13 Mar 2017 17:35:57 +0100 Subject: [PATCH] Add bash completion for topology-aware scheduling - bash completion for `docker service create --placement-pref` - bash completion for `docker service update --placement-pref-{add,rm}` Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 642426ccfb..c0ef8b5808 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -3027,6 +3027,7 @@ _docker_service_update_and_create() { --host --mode --name + --placement-pref --publish -p --secret " @@ -3052,6 +3053,11 @@ _docker_service_update_and_create() { COMPREPLY=( $( compgen -W "global replicated" -- "$cur" ) ) return ;; + --placement-pref) + COMPREPLY=( $( compgen -W "spread" -S = -- "$cur" ) ) + __docker_nospace + return + ;; --secret) __docker_complete_secrets return @@ -3076,6 +3082,8 @@ _docker_service_update_and_create() { --host-add --host-rm --image + --placement-pref-add + --placement-pref-rm --publish-add --publish-rm --rollback @@ -3100,6 +3108,11 @@ _docker_service_update_and_create() { __docker_complete_image_repos_and_tags return ;; + --placement-pref-add|--placement-pref-rm) + COMPREPLY=( $( compgen -W "spread" -S = -- "$cur" ) ) + __docker_nospace + return + ;; --secret-add|--secret-rm) __docker_complete_secrets return @@ -3107,6 +3120,15 @@ _docker_service_update_and_create() { esac fi + local strategy=$(__docker_map_key_of_current_option '--placement-pref|--placement-pref-add|--placement-pref-rm') + case "$strategy" in + spread) + COMPREPLY=( $( compgen -W "engine.labels node.labels" -S . -- "${cur##*=}" ) ) + __docker_nospace + return + ;; + esac + case "$prev" in --endpoint-mode) COMPREPLY=( $( compgen -W "dnsrr vip" -- "$cur" ) )