diff options
-rwxr-xr-x | cache | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# +# cache commands for speed +# +set -eu +CACHE_DIR=~/.cache/command-cache +if [[ "$1" = "clear" ]]; then + rm -rf $CACHE_DIR +else + mkdir -p $CACHE_DIR + file="$CACHE_DIR/$(base64 <<< "$@")" + if [[ ! -e "$file" ]] + then + echo "making $file" >&2 + $@ > "$file" + fi + cat "$file" +fi |