mirror of https://github.com/docker/cli.git
Add windows specific bash completion for `docker run|create`
Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
parent
46c619655f
commit
d9dbe8b6f6
|
@ -456,6 +456,18 @@ __docker_is_experimental() {
|
||||||
[ "$(__docker_q version -f '{{.Server.Experimental}}')" = "true" ]
|
[ "$(__docker_q version -f '{{.Server.Experimental}}')" = "true" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# __docker_daemon_os_is tests whether the currently configured Docker daemon runs
|
||||||
|
# on the operating system passed in as the first argument.
|
||||||
|
# It does so by querying the daemon for its OS. The result is cached for the duration
|
||||||
|
# of one invocation of bash completion so that this function can be used to test for
|
||||||
|
# several different operating systems without additional costs.
|
||||||
|
# Known operating systems: linux, windows.
|
||||||
|
__docker_daemon_os_is() {
|
||||||
|
local expected_os="$1"
|
||||||
|
local actual_os=${daemon_os=$(__docker_q version -f '{{.Server.Os}}')}
|
||||||
|
[ "$actual_os" = "$expected_os" ]
|
||||||
|
}
|
||||||
|
|
||||||
# __docker_pos_first_nonflag finds the position of the first word that is neither
|
# __docker_pos_first_nonflag finds the position of the first word that is neither
|
||||||
# option nor an option's argument. If there are options that require arguments,
|
# 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"
|
# you should pass a glob describing those options, e.g. "--option1|-o|--option2"
|
||||||
|
@ -1401,6 +1413,13 @@ _docker_container_run() {
|
||||||
--volume -v
|
--volume -v
|
||||||
--workdir -w
|
--workdir -w
|
||||||
"
|
"
|
||||||
|
__docker_daemon_os_is windows && options_with_args+="
|
||||||
|
--cpu-count
|
||||||
|
--cpu-percent
|
||||||
|
--credentialspec
|
||||||
|
--io-maxbandwidth
|
||||||
|
--io-maxiops
|
||||||
|
"
|
||||||
|
|
||||||
local boolean_options="
|
local boolean_options="
|
||||||
--disable-content-trust=false
|
--disable-content-trust=false
|
||||||
|
@ -4146,7 +4165,7 @@ _docker() {
|
||||||
--tlskey
|
--tlskey
|
||||||
"
|
"
|
||||||
|
|
||||||
local host config
|
local host config daemon_os
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
|
|
Loading…
Reference in New Issue