Просмотр исходного кода

Fix suppressed blank in completion of `scale --help`

Wrong placement of `compopt -o` introduces an unexpected behavior that did
not matter as long as --help was the only option (you would probably not
continue to type after --help): completion of options would not automatically
append a whitespace character as expected.

For the outstanding addition of the --timeout option, which has an
argument, this would mean that the user would have to type an extra
whitespace after completion of --timeout before the argument could be
added.

Signed-off-by: Harald Albers <[email protected]>
Harald Albers 10 лет назад
Родитель
Сommit
7e22719090
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      contrib/completion/bash/docker-compose

+ 5 - 4
contrib/completion/bash/docker-compose

@@ -278,10 +278,7 @@ _docker_compose_scale() {
 	case "$prev" in
 		=)
 			COMPREPLY=("$cur")
-			;;
-		*)
-			COMPREPLY=( $(compgen -S "=" -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") )
-			compopt -o nospace
+			return
 			;;
 	esac
 
@@ -289,6 +286,10 @@ _docker_compose_scale() {
 		-*)
 			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
 			;;
+		*)
+			COMPREPLY=( $(compgen -S "=" -W "$(___docker_compose_all_services_in_compose_file)" -- "$cur") )
+			compopt -o nospace
+			;;
 	esac
 }