From de0a89a3a4de879cf7962c8f27048fc095b04738 Mon Sep 17 00:00:00 2001 From: Stefan Adams Date: Sat, 13 Dec 2025 09:55:56 -0600 Subject: [PATCH] Check if direnv is installed before allowing --- wtadd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wtadd.sh b/wtadd.sh index e4cd9c8..b41aa9b 100755 --- a/wtadd.sh +++ b/wtadd.sh @@ -169,8 +169,8 @@ function _worktree { warn "Unable to run git pull, there may not be an upstream" fi - # if there was an envrc file, tell direnv that it's ok to run it - if [ -f "$parent_dir/$dirname/.envrc" ]; then + # if there was an envrc file, tell direnv -- if it's installed -- that it's ok to run it + if [ type -t direnv 2>/dev/null && -f "$parent_dir/$dirname/.envrc" ]; then direnv allow "$parent_dir/$dirname" fi @@ -192,4 +192,4 @@ while true; do esac done -_worktree "$@" \ No newline at end of file +_worktree "$@"