2019-11-27 01:24:29 -07:00
|
|
|
# -*- sh -*-
|
|
|
|
|
2019-01-19 19:59:27 -07:00
|
|
|
shim_env_command() {
|
|
|
|
local shim_name="$1"
|
|
|
|
local env_cmd="${2}"
|
2019-01-20 13:02:22 -07:00
|
|
|
local env_args=("${@:3}")
|
2019-01-19 19:59:27 -07:00
|
|
|
|
2019-01-20 01:13:20 -07:00
|
|
|
if [ -z "$shim_name" ]; then
|
2020-09-21 15:27:52 -07:00
|
|
|
printf "usage: asdf env <command>\\n"
|
2019-01-20 01:13:20 -07:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-01-19 19:59:27 -07:00
|
|
|
if [ -z "$env_cmd" ]; then
|
|
|
|
env_cmd="env"
|
|
|
|
fi
|
|
|
|
|
2019-01-20 13:02:22 -07:00
|
|
|
shim_env() {
|
|
|
|
"$env_cmd" "${env_args[@]}"
|
|
|
|
}
|
2019-01-19 19:59:27 -07:00
|
|
|
|
2019-01-20 13:02:22 -07:00
|
|
|
with_shim_executable "$shim_name" shim_env || exit $?
|
2019-01-19 19:59:27 -07:00
|
|
|
}
|
2019-11-27 01:24:29 -07:00
|
|
|
|
|
|
|
shim_env_command "$@"
|