mirror of https://github.com/docker/cli.git
Improve bash completion for users and groups
Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
parent
437b2748c2
commit
49347e571c
|
@ -535,6 +535,15 @@ __docker_complete_signals() {
|
|||
COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo $cur | tr '[:lower:]' '[:upper:]')" ) )
|
||||
}
|
||||
|
||||
__docker_complete_user_group() {
|
||||
if [[ $cur == *:* ]] ; then
|
||||
COMPREPLY=( $(compgen -g -- "${cur#*:}") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -u -S : -- "$cur") )
|
||||
__docker_nospace
|
||||
fi
|
||||
}
|
||||
|
||||
# global options that may appear after the docker command
|
||||
_docker_docker() {
|
||||
local boolean_options="
|
||||
|
@ -851,12 +860,7 @@ _docker_daemon() {
|
|||
return
|
||||
;;
|
||||
--userns-remap)
|
||||
if [[ $cur == *:* ]] ; then
|
||||
COMPREPLY=( $(compgen -g -- "${cur#*:}") )
|
||||
else
|
||||
COMPREPLY=( $(compgen -u -S : -- "$cur") )
|
||||
__docker_nospace
|
||||
fi
|
||||
__docker_complete_user_group
|
||||
return
|
||||
;;
|
||||
$(__docker_to_extglob "$options_with_args") )
|
||||
|
@ -995,6 +999,7 @@ _docker_exec() {
|
|||
|
||||
case "$prev" in
|
||||
--user|-u)
|
||||
__docker_complete_user_group
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
@ -1769,6 +1774,10 @@ _docker_run() {
|
|||
esac
|
||||
return
|
||||
;;
|
||||
--user|-u)
|
||||
__docker_complete_user_group
|
||||
return
|
||||
;;
|
||||
--volume-driver)
|
||||
__docker_complete_plugins Volume
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue