Browse code

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 authored on 2016/12/05 05:11:33
Showing 1 changed files
... ...
@@ -2874,9 +2874,17 @@ _docker_service_update() {
2874 2874
 			COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
2875 2875
 			;;
2876 2876
 		*)
2877
+			local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
2877 2878
 			if [ "$subcommand" = "update" ] ; then
2878
-				__docker_complete_services
2879
+				if [ $cword -eq $counter ]; then
2880
+					__docker_complete_services
2881
+				fi
2882
+			else
2883
+				if [ $cword -eq $counter ]; then
2884
+					__docker_complete_images
2885
+				fi
2879 2886
 			fi
2887
+			;;
2880 2888
 	esac
2881 2889
 }
2882 2890