mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Correct array expansion syntax
This commit is contained in:
parent
97aab882e7
commit
1ed64eb119
@ -16,7 +16,10 @@ shim_env_command() {
|
||||
fi
|
||||
|
||||
shim_env() {
|
||||
"$env_cmd" ${env_args[@]:-}
|
||||
# Yes, the syntax for the expansion is ugly and confusing, but it is what we
|
||||
# need to do to make it work with the nounset option. See
|
||||
# https://stackoverflow.com/q/7577052/ for the details
|
||||
"$env_cmd" ${env_args[@]+"${env_args[@]}"}
|
||||
}
|
||||
|
||||
with_shim_executable "$shim_name" shim_env || exit $?
|
||||
|
@ -785,15 +785,19 @@ with_shim_executable() {
|
||||
version_string=$(get_preset_version_for "$shim_plugin")
|
||||
IFS=' ' read -r -a shim_versions <<<"$version_string"
|
||||
local usable_plugin_versions
|
||||
for shim_version in "${shim_versions[@]:-}"; do
|
||||
|
||||
# Yes, the syntax for the expansion is ugly and confusing, but it is what we
|
||||
# need to do to make it work with the nounset option. See
|
||||
# https://stackoverflow.com/q/7577052/ for the details
|
||||
for shim_version in ${shim_versions[@]+"${shim_versions[@]}"}; do
|
||||
preset_plugin_versions+=("$shim_plugin $shim_version")
|
||||
done
|
||||
done
|
||||
|
||||
if [ -n "${preset_plugin_versions[*]}" ]; then
|
||||
if [ -n "${preset_plugin_versions[*]:-}" ]; then
|
||||
printf "%s %s\\n" "No preset version installed for command" "$shim_name"
|
||||
printf "%s\\n\\n" "Please install a version by running one of the following:"
|
||||
for preset_plugin_version in "${preset_plugin_versions[@]}"; do
|
||||
for preset_plugin_version in "${preset_plugin_versions[@]:-}"; do
|
||||
printf "%s %s\\n" "asdf install" "$preset_plugin_version"
|
||||
done
|
||||
printf "\\n%s %s\\n" "or add one of the following versions in your config file at" "$closest_tool_version"
|
||||
|
Loading…
Reference in New Issue
Block a user