зеркало из https://github.com/microsoft/docker.git
Merge pull request #19811 from albers/completion-user
Improve bash completion for users and groups
This commit is contained in:
Коммит
17be787dca
|
@ -535,6 +535,15 @@ __docker_complete_signals() {
|
||||||
COMPREPLY=( $( compgen -W "${signals[*]} ${signals[*]#SIG}" -- "$( echo $cur | tr '[:lower:]' '[:upper:]')" ) )
|
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
|
# global options that may appear after the docker command
|
||||||
_docker_docker() {
|
_docker_docker() {
|
||||||
local boolean_options="
|
local boolean_options="
|
||||||
|
@ -851,12 +860,7 @@ _docker_daemon() {
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--userns-remap)
|
--userns-remap)
|
||||||
if [[ $cur == *:* ]] ; then
|
__docker_complete_user_group
|
||||||
COMPREPLY=( $(compgen -g -- "${cur#*:}") )
|
|
||||||
else
|
|
||||||
COMPREPLY=( $(compgen -u -S : -- "$cur") )
|
|
||||||
__docker_nospace
|
|
||||||
fi
|
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
$(__docker_to_extglob "$options_with_args") )
|
$(__docker_to_extglob "$options_with_args") )
|
||||||
|
@ -995,6 +999,7 @@ _docker_exec() {
|
||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--user|-u)
|
--user|-u)
|
||||||
|
__docker_complete_user_group
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -1769,6 +1774,10 @@ _docker_run() {
|
||||||
esac
|
esac
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
--user|-u)
|
||||||
|
__docker_complete_user_group
|
||||||
|
return
|
||||||
|
;;
|
||||||
--volume-driver)
|
--volume-driver)
|
||||||
__docker_complete_plugins Volume
|
__docker_complete_plugins Volume
|
||||||
return
|
return
|
||||||
|
|
Загрузка…
Ссылка в новой задаче