zsh autocomplete: fix missing services issue for build/pull commands

Previously, the autocomplete for the build/pull commands would only add
services for which build/image were the _first_ keys, respectively, in
the docker-compose file.

This commit fixes this, so the appropriate services are listed
regardless of the order in which they appear

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

View File

@ -52,7 +52,8 @@ __docker-compose_services_with_key() {
| sed -n -e '/^services:/,/^[^ ]/p' \
| sed -n 's/^ //p' \
| awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
| awk -F: -v key=": +$1:" '$0 ~ key {print $1}' \
| grep " \+$1:" \
| sed "s/:.*//g" \
| grep -Ev "$already_selected"
}