소스 검색

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" ) )
 			;;
 		*)
+			local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
 			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
+			;;
 	esac
 }