Shell-specific caches

This commit is contained in:
Henrik Lissner 2015-12-23 02:19:03 -05:00
parent 3d8f3381c6
commit 9b9d75acc4

View file

@ -20,7 +20,7 @@ cache() {
[[ ! -d "$CACHE_DIR" ]] && mkdir -p "$CACHE_DIR" [[ ! -d "$CACHE_DIR" ]] && mkdir -p "$CACHE_DIR"
is-callable "$1" || return 1 is-callable "$1" || return 1
local cache="${CACHE_DIR}/$1" local cache="${CACHE_DIR}/$1-$(basename $SHELL)"
if ! [[ -f "$cache" && -s "$cache" ]]; then if ! [[ -f "$cache" && -s "$cache" ]]; then
echo "Caching $1" echo "Caching $1"
$@ > "$cache" 2> /dev/null $@ > "$cache" 2> /dev/null