Skip to content

Commit 83cdc0f

Browse files
authored
Merge pull request #704 from albers/completion--platform
Add bash completion for `--platform`
2 parents 6b63d7b + 15f7841 commit 83cdc0f

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

contrib/completion/bash/docker

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,9 @@ _docker_container_run_and_create() {
17681768
--io-maxiops
17691769
--isolation
17701770
"
1771+
__docker_daemon_is_experimental && options_with_args+="
1772+
--platform
1773+
"
17711774

17721775
local boolean_options="
17731776
--disable-content-trust=false
@@ -2472,10 +2475,15 @@ _docker_image_build() {
24722475
--quiet -q
24732476
--rm
24742477
"
2475-
__docker_daemon_is_experimental && boolean_options+="
2476-
--squash
2477-
--stream
2478-
"
2478+
if __docker_daemon_is_experimental ; then
2479+
options_with_args+="
2480+
--platform
2481+
"
2482+
boolean_options+="
2483+
--squash
2484+
--stream
2485+
"
2486+
fi
24792487

24802488
local all_options="$options_with_args $boolean_options"
24812489

@@ -2687,12 +2695,21 @@ _docker_image_prune() {
26872695
}
26882696

26892697
_docker_image_pull() {
2698+
case "$prev" in
2699+
--platform)
2700+
return
2701+
;;
2702+
esac
2703+
26902704
case "$cur" in
26912705
-*)
2692-
COMPREPLY=( $( compgen -W "--all-tags -a --disable-content-trust=false --help" -- "$cur" ) )
2706+
local options="--all-tags -a --disable-content-trust=false --help"
2707+
__docker_daemon_is_experimental && options+=" --platform"
2708+
2709+
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
26932710
;;
26942711
*)
2695-
local counter=$(__docker_pos_first_nonflag)
2712+
local counter=$(__docker_pos_first_nonflag --platform)
26962713
if [ "$cword" -eq "$counter" ]; then
26972714
for arg in "${COMP_WORDS[@]}"; do
26982715
case "$arg" in

0 commit comments

Comments
 (0)