Ignore variables used by direnv
All variables matching DIRENV_* are excluded to not influence direnv behavior.master
parent
ac83f17b77
commit
f6fc817e84
22
direnv-cache
22
direnv-cache
|
@ -32,22 +32,26 @@ diffEnvs() {
|
|||
|
||||
while IFS= read -r -d '' line; do
|
||||
name=$(tr -d '\0' <<<"$line" | head -n1 | cut -f1 -d'=')
|
||||
if ! getByName "$name" "$new" >/dev/null; then
|
||||
echo "export -n '${name}'"
|
||||
if ! [[ "$name" = DIRENV_* ]]; then
|
||||
if ! getByName "$name" "$new" >/dev/null; then
|
||||
echo "export -n '${name}'"
|
||||
fi
|
||||
fi
|
||||
done <"$old"
|
||||
|
||||
while IFS= read -rd $'\0' line; do
|
||||
name=$(tr -d '\0' <<<"$line" | head -n1 | cut -f1 -d'=')
|
||||
if getByName "$name" "$old" >/dev/null; then
|
||||
# found in old env, check if values match
|
||||
if ! grep -z "^${line}\$" "$old" >/dev/null; then
|
||||
# variable has changed
|
||||
if ! [[ "$name" = DIRENV_* ]]; then
|
||||
if getByName "$name" "$old" >/dev/null; then
|
||||
# found in old env, check if values match
|
||||
if ! grep -z "^${line}\$" "$old" >/dev/null; then
|
||||
# variable has changed
|
||||
echo "export ${line@Q}"
|
||||
fi
|
||||
else
|
||||
# variable is new
|
||||
echo "export ${line@Q}"
|
||||
fi
|
||||
else
|
||||
# variable is new
|
||||
echo "export ${line@Q}"
|
||||
fi
|
||||
done <"$new"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue