zsh autocomplete: fix issue when filtering on already selected services

Previously, the filtering on already selected services would break when
one service was a substring of another.

This commit fixes that.

Signed-off-by: Andre Eriksson <aepubemail@gmail.com>
This commit is contained in:
Andre Eriksson 2016-03-29 21:31:06 -07:00 committed by Andre Eriksson
parent 048408af48
commit 612d263d74
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ __docker-compose_all_services_in_compose_file() {
local -a services
already_selected=$(echo $words | tr " " "|")
__docker-compose_q config --services \
| grep -Ev "$already_selected"
| grep -Ev "^(${already_selected})$"
}
# All services, even those without an existing container
@ -54,7 +54,7 @@ __docker-compose_services_with_key() {
| awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
| grep " \+$1:" \
| sed "s/:.*//g" \
| grep -Ev "$already_selected"
| grep -Ev "^(${already_selected})$"
}
# All services that are defined by a Dockerfile reference