~ecs/tm

4db95713b0c71235665e6bb897e84b9821809d35 — Ember Sawady 3 years ago 6e0ad4c
init: set $TM_DIR before sourcing lib.sh
2 files changed, 5 insertions(+), 1 deletions(-)

M lib.sh
M tm-init
M lib.sh => lib.sh +4 -1
@@ 52,8 52,11 @@ write() {
}

path="$PWD"
while ! [ -d "$path/.tm" ] || [ "z$path" = "z/" ]; do
while ! [ -d "$path/.tm" ]; do
	path="$path/.."
	cd -- "$path"
	[ "z$PWD" = "z/" ] && cd - >/dev/null && break
	cd - >/dev/null
done
cd -- "$path"
export TM_DIR="${TM_DIR:-$PWD/.tm}"

M tm-init => tm-init +1 -0
@@ 1,5 1,6 @@
#!/bin/sh -eu

export TM_DIR="${TM_DIR:-$PWD/.tm}"
. "$(dirname -- "$0")/lib.sh"
[ $# -ne 0 ] && abort "usage: tm init"
[ -z "${TM_AUTHOR:-}" ] && abort "error: TM_AUTHOR unset"