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 <github@albersweb.de>
This commit is contained in:
Harald Albers 2017-03-13 17:35:57 +01:00 committed by Tibor Vass
parent 84ccb00486
commit f50f5f8944
1 changed files with 22 additions and 0 deletions

View File

@ -3027,6 +3027,7 @@ _docker_service_update_and_create() {
--host --host
--mode --mode
--name --name
--placement-pref
--publish -p --publish -p
--secret --secret
" "
@ -3052,6 +3053,11 @@ _docker_service_update_and_create() {
COMPREPLY=( $( compgen -W "global replicated" -- "$cur" ) ) COMPREPLY=( $( compgen -W "global replicated" -- "$cur" ) )
return return
;; ;;
--placement-pref)
COMPREPLY=( $( compgen -W "spread" -S = -- "$cur" ) )
__docker_nospace
return
;;
--secret) --secret)
__docker_complete_secrets __docker_complete_secrets
return return
@ -3076,6 +3082,8 @@ _docker_service_update_and_create() {
--host-add --host-add
--host-rm --host-rm
--image --image
--placement-pref-add
--placement-pref-rm
--publish-add --publish-add
--publish-rm --publish-rm
--rollback --rollback
@ -3100,6 +3108,11 @@ _docker_service_update_and_create() {
__docker_complete_image_repos_and_tags __docker_complete_image_repos_and_tags
return return
;; ;;
--placement-pref-add|--placement-pref-rm)
COMPREPLY=( $( compgen -W "spread" -S = -- "$cur" ) )
__docker_nospace
return
;;
--secret-add|--secret-rm) --secret-add|--secret-rm)
__docker_complete_secrets __docker_complete_secrets
return return
@ -3107,6 +3120,15 @@ _docker_service_update_and_create() {
esac esac
fi 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 case "$prev" in
--endpoint-mode) --endpoint-mode)
COMPREPLY=( $( compgen -W "dnsrr vip" -- "$cur" ) ) COMPREPLY=( $( compgen -W "dnsrr vip" -- "$cur" ) )