From 04d50750f5a93215ca5e76d4e5622757c808eb94 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Sun, 16 Dec 2018 17:00:40 +0100 Subject: [PATCH] new: provide ``option-get`` with possible interpolation. --- bin/compose-core | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/compose-core b/bin/compose-core index ea6e425..562a6a6 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -1548,6 +1548,18 @@ yaml_get_interpret() { export -f yaml_get_interpret +options-get () { + local key="$1" out + service_def=$(get_compose_service_def "$SERVICE_NAME") || return 1 + if ! out=$(echo "$service_def" | shyaml -y get-value "options.$key" 2>/dev/null); then + err "The key $WHITE$key$NORMAL was not found in base service compose definition.." + return 1 + fi + echo "$out" | yaml_get_interpret +} +export -f options-get + + relation-base-compose-get () { local key="$1" out if ! out=$(echo "$RELATION_BASE_COMPOSE_DEF" | shyaml -y get-value "options.$key" 2>/dev/null); then