17 lines
402 B
Bash
17 lines
402 B
Bash
# -*- mode: sh -*-
|
|
|
|
cache() {
|
|
|
|
local cacheDir="${XDG_CACHE_HOME:-$HOME/.cache}/direnv-cache"
|
|
mkdir -p "$cacheDir"
|
|
local cacheFile
|
|
cacheFile="${cacheDir}/$(pwd | sha1sum | tr -d ' -')"
|
|
cat - > "${cacheFile}.recipe"
|
|
if [[ -e "$cacheFile" ]]; then
|
|
echo "Using cached environment from $cacheFile"
|
|
. $cacheFile
|
|
else
|
|
echo "Environment not cached"
|
|
fi
|
|
}
|