fix bash completion for `docker run --security-opt`

Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
Harald Albers 2016-03-28 08:07:28 -07:00 committed by Tibor Vass
parent 043b5f05ed
commit 062454975a
1 changed files with 20 additions and 20 deletions

View File

@ -1704,6 +1704,24 @@ _docker_run() {
__docker_complete_log_driver_options && return __docker_complete_log_driver_options && return
__docker_complete_restart && return __docker_complete_restart && return
local key=$(__docker_map_key_of_current_option '--security-opt')
case "$key" in
label)
[[ $cur == *: ]] && return
COMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "${cur##*=}") )
if [ "${COMPREPLY[*]}" != "disable" ] ; then
__docker_nospace
fi
return
;;
seccomp)
local cur=${cur##*=}
_filedir
COMPREPLY+=( $( compgen -W "unconfined" -- "$cur" ) )
return
;;
esac
case "$prev" in case "$prev" in
--add-host) --add-host)
case "$cur" in case "$cur" in
@ -1801,26 +1819,8 @@ _docker_run() {
return return
;; ;;
--security-opt) --security-opt)
case "$cur" in COMPREPLY=( $( compgen -W "apparmor label seccomp" -S "=" -- "$cur") )
label=*:*)
;;
label=*)
local cur=${cur##*=}
COMPREPLY=( $( compgen -W "user: role: type: level: disable" -- "$cur") )
if [ "${COMPREPLY[*]}" != "disable" ] ; then
__docker_nospace __docker_nospace
fi
;;
seccomp=*)
local cur=${cur##*=}
_filedir
COMPREPLY+=( $( compgen -W "unconfined" -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W "label apparmor seccomp" -S ":" -- "$cur") )
__docker_nospace
;;
esac
return return
;; ;;
--user|-u) --user|-u)