Minor bash completion improvements/fixes
@@ -1372,10 +1372,7 @@ _docker_container_commit() {
if [ "$cword" -eq "$counter" ]; then
__docker_complete_containers_all
return
- fi
- (( counter++ ))
-
- if [ "$cword" -eq "$counter" ]; then
+ elif [ "$cword" -eq "$((counter + 1))" ]; then
__docker_complete_images --repo --tag
return
fi
@@ -2593,7 +2590,7 @@ _docker_image_history() {
COMPREPLY=( $( compgen -W "--format --help --human=false -H=false --no-trunc --quiet -q" -- "$cur" ) )
;;
*)
- local counter=$(__docker_pos_first_nonflag)
+ local counter=$(__docker_pos_first_nonflag '--format')
if [ "$cword" -eq "$counter" ]; then
__docker_complete_images --force-tag --id
fi
@@ -2619,11 +2616,9 @@ _docker_image_import() {
*)
local counter=$(__docker_pos_first_nonflag '--change|-c|--message|-m')
if [ "$cword" -eq "$counter" ]; then
+ _filedir
return
- fi
- (( counter++ ))
-
- if [ "$cword" -eq "$counter" ]; then
+ elif [ "$cword" -eq "$((counter + 1))" ]; then
__docker_complete_images --repo --tag
return
fi
@@ -2798,10 +2793,7 @@ _docker_image_tag() {
if [ "$cword" -eq "$counter" ]; then
__docker_complete_images --force-tag --id
return
- fi
- (( counter++ ))
-
- if [ "$cword" -eq "$counter" ]; then
+ elif [ "$cword" -eq "$((counter + 1))" ]; then
__docker_complete_images --repo --tag
return
fi
