@@ -239,7 +239,7 @@ __docker_images() {
239239 __docker_q image ls --no-trunc --format " ${format% \\ n} " $all " $@ " | grep -v ' <none>$'
240240}
241241
242- # __docker_complete_images appies completion of images based on the current value of `$cur` or
242+ # __docker_complete_images applies completion of images based on the current value of `$cur` or
243243# the value of the optional first option `--cur`, if given.
244244# See __docker_images for customization of the returned items.
245245__docker_complete_images () {
@@ -1372,10 +1372,7 @@ _docker_container_commit() {
13721372 if [ " $cword " -eq " $counter " ]; then
13731373 __docker_complete_containers_all
13741374 return
1375- fi
1376- (( counter++ ))
1377-
1378- if [ " $cword " -eq " $counter " ]; then
1375+ elif [ " $cword " -eq " $(( counter + 1 )) " ]; then
13791376 __docker_complete_images --repo --tag
13801377 return
13811378 fi
@@ -2593,7 +2590,7 @@ _docker_image_history() {
25932590 COMPREPLY=( $( compgen -W " --format --help --human=false -H=false --no-trunc --quiet -q" -- " $cur " ) )
25942591 ;;
25952592 * )
2596- local counter=$( __docker_pos_first_nonflag)
2593+ local counter=$( __docker_pos_first_nonflag ' --format ' )
25972594 if [ " $cword " -eq " $counter " ]; then
25982595 __docker_complete_images --force-tag --id
25992596 fi
@@ -2619,11 +2616,9 @@ _docker_image_import() {
26192616 * )
26202617 local counter=$( __docker_pos_first_nonflag ' --change|-c|--message|-m' )
26212618 if [ " $cword " -eq " $counter " ]; then
2619+ _filedir
26222620 return
2623- fi
2624- (( counter++ ))
2625-
2626- if [ " $cword " -eq " $counter " ]; then
2621+ elif [ " $cword " -eq " $(( counter + 1 )) " ]; then
26272622 __docker_complete_images --repo --tag
26282623 return
26292624 fi
@@ -2798,10 +2793,7 @@ _docker_image_tag() {
27982793 if [ " $cword " -eq " $counter " ]; then
27992794 __docker_complete_images --force-tag --id
28002795 return
2801- fi
2802- (( counter++ ))
2803-
2804- if [ " $cword " -eq " $counter " ]; then
2796+ elif [ " $cword " -eq " $(( counter + 1 )) " ]; then
28052797 __docker_complete_images --repo --tag
28062798 return
28072799 fi
0 commit comments