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}`
@@ -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" ) )
