From 1bae19973671dde75506c541ba576de4dae8cb29 Mon Sep 17 00:00:00 2001 From: Thomas Boyer Date: Thu, 23 Jan 2025 20:37:00 +0100 Subject: [PATCH] fix(direnv): warn user if command not found (#12840) Co-authored-by: Carlo Sala --- plugins/direnv/direnv.plugin.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/direnv/direnv.plugin.zsh b/plugins/direnv/direnv.plugin.zsh index 0a33194d..c026dbe7 100644 --- a/plugins/direnv/direnv.plugin.zsh +++ b/plugins/direnv/direnv.plugin.zsh @@ -1,5 +1,8 @@ -# Don't continue if direnv is not found -command -v direnv &>/dev/null || return +# If direnv is not found, don't continue and print a warning +if (( ! $+commands[direnv] )); then + echo "Warning: direnv not found. Please install direnv and ensure it's in your PATH before using this plugin." + return +fi _direnv_hook() { trap -- '' SIGINT;