asdf/lib/commands/shim-env.sh
Victor Hugo Borja ab59e5618f Move common functionality to utils.sh
- Make shim-exec, shim-env, and which use the same logic to look for commands
- Make sure shim-exec and which use a plugin exec-path hook as documented
  (the hook takes a relative path to the executable and returns also
   a relative path, possibly modified)
- Fix shellchecks
2019-01-20 14:02:22 -06:00

21 lines
344 B
Bash

shim_env_command() {
local shim_name="$1"
local env_cmd="${2}"
local env_args=("${@:3}")
if [ -z "$shim_name" ]; then
echo "usage: asdf env <command>"
exit 1
fi
if [ -z "$env_cmd" ]; then
env_cmd="env"
fi
shim_env() {
"$env_cmd" "${env_args[@]}"
}
with_shim_executable "$shim_name" shim_env || exit $?
}