diff --git a/bin/utils.sh b/bin/utils.sh index 1d42a38..dd82f6d 100755 --- a/bin/utils.sh +++ b/bin/utils.sh @@ -9,7 +9,7 @@ echoerr() { } sops_bin() { - echo "$MISE_INSTALL_PATH/bin/sops" + echo "${MISE_INSTALL_PATH}/bin/sops" } sops_env() { @@ -18,6 +18,13 @@ sops_env() { return 1 fi + # export names filter + if [[ -n ${MISE_TOOL_OPTS__NAMES-} ]]; then + NAMES="\(${MISE_TOOL_OPTS__NAMES//:/\\|}\)" + else + NAMES="\w\+" + fi + while read -r filename; do if [[ ${filename} != /* ]] && [[ -n ${MISE_PROJECT_ROOT-} ]]; then filename="${MISE_PROJECT_ROOT-}/${filename}" @@ -27,5 +34,5 @@ sops_env() { continue fi "$(sops_bin)" -d "${filename}" - done < <(tr : $'\n' <<<"${MISE_TOOL_OPTS__FILENAME}") + done < <(tr : $'\n' <<<"${MISE_TOOL_OPTS__FILENAME}") | grep "^export ${NAMES}=" }