Browse code

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

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

Kenfe-Mickael Laventure authored on 2016/06/04 01:12:20
Showing 1 changed files
... ...
@@ -189,6 +189,14 @@ __docker_complete_plugins() {
189 189
 	COMPREPLY=( $(compgen -W "$(__docker_plugins $1)" -- "$cur") )
190 190
 }
191 191
 
192
+__docker_runtimes() {
193
+	__docker_q info | sed -n 's/^Runtimes: \(.*\)/\1/p'
194
+}
195
+
196
+__docker_complete_runtimes() {
197
+	COMPREPLY=( $(compgen -W "$(__docker_runtimes)" -- "$cur") )
198
+}
199
+
192 200
 # Finds the position of the first word that is neither option nor an option's argument.
193 201
 # If there are options that require arguments, you should pass a glob describing those
194 202
 # options, e.g. "--option1|-o|--option2"
... ...
@@ -791,6 +799,7 @@ _docker_daemon() {
791 791
 	"
792 792
 	local options_with_args="
793 793
 		$global_options_with_args
794
+		--add-runtime
794 795
 		--api-cors-header
795 796
 		--authorization-plugin
796 797
 		--bip
... ...
@@ -1706,6 +1715,7 @@ _docker_run() {
1706 1706
 		--pids-limit
1707 1707
 		--publish -p
1708 1708
 		--restart
1709
+		--runtime
1709 1710
 		--security-opt
1710 1711
 		--shm-size
1711 1712
 		--stop-signal
... ...
@@ -1884,6 +1894,10 @@ _docker_run() {
1884 1884
 			esac
1885 1885
 			return
1886 1886
 			;;
1887
+		--runtime)
1888
+			__docker_complete_runtimes
1889
+			return
1890
+			;;
1887 1891
 		--security-opt)
1888 1892
 			COMPREPLY=( $( compgen -W "apparmor= label= no-new-privileges seccomp=" -- "$cur") )
1889 1893
 			if [ "${COMPREPLY[*]}" != "no-new-privileges" ] ; then