Merge pull request #704 from albers/completion--platform

Add bash completion for `--platform`
This commit is contained in:
Sebastiaan van Stijn 2017-12-04 13:19:37 -08:00 committed by GitHub
commit 83cdc0f1bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 6 deletions

View File

@ -1768,6 +1768,9 @@ _docker_container_run_and_create() {
--io-maxiops
--isolation
"
__docker_daemon_is_experimental && options_with_args+="
--platform
"
local boolean_options="
--disable-content-trust=false
@ -2472,10 +2475,15 @@ _docker_image_build() {
--quiet -q
--rm
"
__docker_daemon_is_experimental && boolean_options+="
--squash
--stream
"
if __docker_daemon_is_experimental ; then
options_with_args+="
--platform
"
boolean_options+="
--squash
--stream
"
fi
local all_options="$options_with_args $boolean_options"
@ -2687,12 +2695,21 @@ _docker_image_prune() {
}
_docker_image_pull() {
case "$prev" in
--platform)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--all-tags -a --disable-content-trust=false --help" -- "$cur" ) )
local options="--all-tags -a --disable-content-trust=false --help"
__docker_daemon_is_experimental && options+=" --platform"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
;;
*)
local counter=$(__docker_pos_first_nonflag)
local counter=$(__docker_pos_first_nonflag --platform)
if [ "$cword" -eq "$counter" ]; then
for arg in "${COMP_WORDS[@]}"; do
case "$arg" in