dave1010 / clipea

📎🟢 Like Clippy but for the CLI. A blazing fast AI helper for your command line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clipea.zsh: use `builtin` to invoke `which`

garyo opened this issue · comments

I've aliased which in my zsh to type -a for my convenience. This breaks the use of it in clipea.zsh. Here's a patch to fix that:

diff --git a/clipea/clipea.zsh b/clipea/clipea.zsh
index c48542b..f883b68 100755
--- a/clipea/clipea.zsh
+++ b/clipea/clipea.zsh
@@ -14,12 +14,12 @@ CLIPEA_SCRIPT_DIR=$(dirname $(readlink -f ${(%):-%x}))
 
 CLIPEA_PYTHON=
 
-CLIPEA_PATH=$(which clipea)
+CLIPEA_PATH=$(builtin which clipea)
 
 # Run clipea from the current dir if possible
 if [[ -f $CLIPEA_SCRIPT_DIR/__main__.py ]]; then
     CLIPEA_PATH=$CLIPEA_SCRIPT_DIR
-    CLIPEA_PYTHON="$(which python3 || which python)"
+    CLIPEA_PYTHON="$(builtin which python3 || builtin which python)"
 fi
 
 # Execute clipea with an environment variable

Or alternatively you could use whence but still protect it with builtin.

Nice catch. Thanks for the diff.

Fixed in d16f031

@all-contributors please add @garyo for code

@dave1010

I've put up a pull request to add @garyo! 🎉