Add bash completion support for --runtime and --add-runtime

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2016-06-03 09:12:20 -07:00
parent 1a6ed50e1f
commit 6e9bf4d316
1 changed files with 14 additions and 0 deletions

View File

@ -189,6 +189,14 @@ __docker_complete_plugins() {
COMPREPLY=( $(compgen -W "$(__docker_plugins $1)" -- "$cur") ) COMPREPLY=( $(compgen -W "$(__docker_plugins $1)" -- "$cur") )
} }
__docker_runtimes() {
__docker_q info | sed -n 's/^Runtimes: \(.*\)/\1/p'
}
__docker_complete_runtimes() {
COMPREPLY=( $(compgen -W "$(__docker_runtimes)" -- "$cur") )
}
# Finds the position of the first word that is neither option nor an option's argument. # Finds the position of the first word that is neither option nor an option's argument.
# If there are options that require arguments, you should pass a glob describing those # If there are options that require arguments, you should pass a glob describing those
# options, e.g. "--option1|-o|--option2" # options, e.g. "--option1|-o|--option2"
@ -791,6 +799,7 @@ _docker_daemon() {
" "
local options_with_args=" local options_with_args="
$global_options_with_args $global_options_with_args
--add-runtime
--api-cors-header --api-cors-header
--authorization-plugin --authorization-plugin
--bip --bip
@ -1706,6 +1715,7 @@ _docker_run() {
--pids-limit --pids-limit
--publish -p --publish -p
--restart --restart
--runtime
--security-opt --security-opt
--shm-size --shm-size
--stop-signal --stop-signal
@ -1884,6 +1894,10 @@ _docker_run() {
esac esac
return return
;; ;;
--runtime)
__docker_complete_runtimes
return
;;
--security-opt) --security-opt)
COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp=" -- "$cur") ) COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp=" -- "$cur") )
if [ "${COMPREPLY[*]}" != "no-new-privileges" ] ; then if [ "${COMPREPLY[*]}" != "no-new-privileges" ] ; then