Merge pull request #2714 from albers/completion-ulimits

Improve bash completion for ulimits
This commit is contained in:
Silvin Lubecki 2020-09-14 14:02:55 +02:00 committed by GitHub
commit e0eba83bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 50 additions and 0 deletions

View File

@ -1149,6 +1149,36 @@ __docker_complete_stack_orchestrator_options() {
return 1 return 1
} }
__docker_complete_ulimits() {
local limits="
as
chroot
core
cpu
data
fsize
locks
maxlogins
maxsyslogins
memlock
msgqueue
nice
nofile
nproc
priority
rss
rtprio
sigpending
stack
"
if [ "$1" = "--rm" ] ; then
COMPREPLY=( $( compgen -W "$limits" -- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$limits" -S = -- "$cur" ) )
__docker_nospace
fi
}
__docker_complete_user_group() { __docker_complete_user_group() {
if [[ $cur == *:* ]] ; then if [[ $cur == *:* ]] ; then
COMPREPLY=( $(compgen -g -- "${cur#*:}") ) COMPREPLY=( $(compgen -g -- "${cur#*:}") )
@ -2148,6 +2178,10 @@ _docker_container_run_and_create() {
__docker_nospace __docker_nospace
return return
;; ;;
--ulimit)
__docker_complete_ulimits
return
;;
--user|-u) --user|-u)
__docker_complete_user_group __docker_complete_user_group
return return
@ -2634,6 +2668,10 @@ _docker_daemon() {
_filedir _filedir
return return
;; ;;
--default-ulimit)
__docker_complete_ulimits
return
;;
--exec-root|--data-root) --exec-root|--data-root)
_filedir -d _filedir -d
return return
@ -2897,6 +2935,10 @@ _docker_image_build() {
COMPREPLY=( $( compgen -W "$targets" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$targets" -- "$cur" ) )
return return
;; ;;
--ulimit)
__docker_complete_ulimits
return
;;
$(__docker_to_extglob "$options_with_args") ) $(__docker_to_extglob "$options_with_args") )
return return
;; ;;
@ -3914,6 +3956,14 @@ _docker_service_update_and_create() {
COMPREPLY=( $( compgen -W "continue pause rollback" -- "$cur" ) ) COMPREPLY=( $( compgen -W "continue pause rollback" -- "$cur" ) )
return return
;; ;;
--ulimit|--ulimit-add)
__docker_complete_ulimits
return
;;
--ulimit-rm)
__docker_complete_ulimits --rm
return
;;
--update-order|--rollback-order) --update-order|--rollback-order)
COMPREPLY=( $( compgen -W "start-first stop-first" -- "$cur" ) ) COMPREPLY=( $( compgen -W "start-first stop-first" -- "$cur" ) )
return return