Add bash completion for `--platform`
@@ -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+="
+ 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
