浏览代码

Fix bash completion for `docker service create|update

Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit be5685e4bffc88a6cd3a093ee883c5335758266d)
Signed-off-by: Victor Vieux <vieux@docker.com>
Harald Albers 8 年之前
父节点
当前提交
fd7aee8fe0
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      contrib/completion/bash/docker

+ 9 - 1
contrib/completion/bash/docker

@@ -2874,9 +2874,17 @@ _docker_service_update() {
 			COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
 			COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
 			;;
 			;;
 		*)
 		*)
+			local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
 			if [ "$subcommand" = "update" ] ; then
 			if [ "$subcommand" = "update" ] ; then
-				__docker_complete_services
+				if [ $cword -eq $counter ]; then
+					__docker_complete_services
+				fi
+			else
+				if [ $cword -eq $counter ]; then
+					__docker_complete_images
+				fi
 			fi
 			fi
+			;;
 	esac
 	esac
 }
 }