mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 09:38:16 -07:00
30 lines
531 B
Bash
30 lines
531 B
Bash
# -*- sh -*-
|
|
|
|
which_command() {
|
|
local shim_name
|
|
shim_name=$(basename "$1")
|
|
|
|
if [ -z "$shim_name" ]; then
|
|
echo "usage: asdf which <command>"
|
|
exit 1
|
|
fi
|
|
|
|
print_exec() {
|
|
local plugin_name="$1"
|
|
local version="$2"
|
|
local executable_path="$3"
|
|
|
|
if [ ! -x "$executable_path" ]; then
|
|
echo "No ${shim_name} executable found for ${plugin_name} ${version}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "$executable_path"
|
|
exit 0
|
|
}
|
|
|
|
with_shim_executable "$shim_name" print_exec || exit 1
|
|
}
|
|
|
|
which_command "$@"
|