# HG changeset patch # User Meredith Howard # Date 1637893143 18000 # Node ID b883fb5c47922c06b54ce3e4df8548bab81d962f # Parent ea852d5451737e6b03d4d06b71b59a1680ac7258 filter out shims that wont work diff --git a/.lib/sh/stubexec.sh b/.lib/sh/stubexec.sh --- a/.lib/sh/stubexec.sh +++ b/.lib/sh/stubexec.sh @@ -4,9 +4,25 @@ realpath() { (cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file") } +shim_filter() { + local binpath='' + while read binpath; do + case "$binpath" in + */.plenv/shims/*) + plenv which $1 >/dev/null 2>&1 || continue + ;; + */.asdf/shims/*) + asdf which $1 >/dev/null 2>&1 || continue + ;; + esac + echo "$binpath" + done +} + realbin() { which -a $(basename $1) | grep -v "$(realpath $1)" | + shim_filter | head -n 1 }