chore(shell): add custom command-path helper

This commit is contained in:
Jim Myhrberg
2024-06-06 18:33:38 +01:00
parent 12b5ecee91
commit d9cb73260e
8 changed files with 16 additions and 12 deletions

6
zshenv
View File

@@ -68,6 +68,10 @@ command-exists() {
return $?
}
command-path() {
echo "${commands[$1]}"
}
source-if-exists() {
if [ -f "$1" ]; then
source "$1"
@@ -107,7 +111,7 @@ cached-eval() {
return 1
fi
local md5_cmd="$(command -v md5 || command -v md5sum)"
local md5_cmd="$(command-path md5 || command-path md5sum)"
local cache_hash="$(echo -n "${source_file}:${script}" | "$md5_cmd" | awk '{print $1}')"
local cache_file="${cache_dir}/${cache_hash}.cache.zsh"