Add bash completion for `--platform`

Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
Harald Albers 2017-11-20 13:19:31 +01:00
parent d921d5cc39
commit 15f78417b9
1 changed files with 23 additions and 6 deletions

View File

@ -1768,6 +1768,9 @@ _docker_container_run_and_create() {
--io-maxiops --io-maxiops
--isolation --isolation
" "
__docker_daemon_is_experimental && options_with_args+="
--platform
"
local boolean_options=" local boolean_options="
--disable-content-trust=false --disable-content-trust=false
@ -2472,10 +2475,15 @@ _docker_image_build() {
--quiet -q --quiet -q
--rm --rm
" "
__docker_daemon_is_experimental && boolean_options+=" if __docker_daemon_is_experimental ; then
options_with_args+="
--platform
"
boolean_options+="
--squash --squash
--stream --stream
" "
fi
local all_options="$options_with_args $boolean_options" local all_options="$options_with_args $boolean_options"
@ -2687,12 +2695,21 @@ _docker_image_prune() {
} }
_docker_image_pull() { _docker_image_pull() {
case "$prev" in
--platform)
return
;;
esac
case "$cur" in 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 if [ "$cword" -eq "$counter" ]; then
for arg in "${COMP_WORDS[@]}"; do for arg in "${COMP_WORDS[@]}"; do
case "$arg" in case "$arg" in