~ecs/tm

9729bf9f9e8d2457dd163f1e20c89d3498818e27 — Ember Sawady 3 years ago a3bcbe6
Look for $TM_DIR lower in the filesystem
1 files changed, 7 insertions(+), 2 deletions(-)

M lib.sh
M lib.sh => lib.sh +7 -2
@@ 1,11 1,16 @@
# TODO: look for TM_DIR lower in the filesystem
unset CDPATH
path="$PWD"
while ! [ -d "$path/.tm" ] || [ "z$path" = "z/" ]; do
	path="$path/.."
done
cd -- "$path"
export TM_DIR="${TM_DIR:-$PWD/.tm}"
cd - >/dev/null
export TM_WS="${TM_WS:-$TM_DIR/..}"
export TM_IGNORE="${TM_IGNORE:-$TM_WS/.tmignore}"
TMPDIR="${TMPDIR:-/tmp}"
# TODO: replace this with something POSIX
TMPDIR="$(mktemp -d "$TMPDIR/tm.XXXXXXX")"
unset CDPATH
trap "rm -rf '$TMPDIR'; exit" INT
trap "rm -rf '$TMPDIR'" EXIT