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 committed by Tibor Vass
parent 48ae78b9b7
commit 5a9cc4cea8
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") )
}
__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.
# If there are options that require arguments, you should pass a glob describing those
# options, e.g. "--option1|-o|--option2"
@ -791,6 +799,7 @@ _docker_daemon() {
"
local options_with_args="
$global_options_with_args
--add-runtime
--api-cors-header
--authorization-plugin
--bip
@ -1706,6 +1715,7 @@ _docker_run() {
--pids-limit
--publish -p
--restart
--runtime
--security-opt
--shm-size
--stop-signal
@ -1884,6 +1894,10 @@ _docker_run() {
esac
return
;;
--runtime)
__docker_complete_runtimes
return
;;
--security-opt)
COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp=" -- "$cur") )
if [ "${COMPREPLY[*]}" != "no-new-privileges" ] ; then