@@ -22,33 +22,36 @@ install_command() {
2222 display_error " You must specify a name and a version to install"
2323 exit 1
2424 else
25- install_tool_version $plugin_name $full_version
25+ install_tool_version " $plugin_name " " $full_version "
2626 fi
2727}
2828
2929get_concurrency () {
3030 if which nproc > /dev/null 2>&1 ; then
31- echo $( nproc)
31+ nproc
3232 elif which sysctl > /dev/null 2>&1 && sysctl hw.ncpu > /dev/null 2>&1 ; then
33- echo $( sysctl -n hw.ncpu)
33+ sysctl -n hw.ncpu
3434 elif [ -f /proc/cpuinfo ]; then
35- echo $( grep -c processor /proc/cpuinfo)
35+ grep -c processor /proc/cpuinfo
3636 else
3737 echo " 1"
3838 fi
3939}
4040
4141install_local_tool_versions () {
4242 if [ -f " $( pwd) /.tool-versions" ]; then
43- local asdf_versions_path=" $( pwd) /.tool-versions"
43+ local asdf_versions_path
44+ asdf_versions_path=" $( pwd) /.tool-versions"
4445
45- while read tool_line; do
46- IFS=' ' read -a tool_info <<< $tool_line
47- local tool_name=$( echo " ${tool_info[0]} " | xargs)
48- local tool_version=$( echo " ${tool_info[1]} " | xargs)
46+ while read -r tool_line; do
47+ IFS=' ' read -r -a tool_info <<< " $tool_line"
48+ local tool_name
49+ tool_name=$( echo " ${tool_info[0]} " | xargs)
50+ local tool_version
51+ tool_version=$( echo " ${tool_info[1]} " | xargs)
4952
5053 if ! [[ -z " $tool_name " || -z " $tool_version " ]]; then
51- install_tool_version $tool_name $tool_version
54+ install_tool_version " $tool_name " " $tool_version "
5255 fi
5356 done < " $asdf_versions_path "
5457 else
@@ -62,11 +65,12 @@ install_local_tool_versions() {
6265install_tool_version () {
6366 local plugin_name=$1
6467 local full_version=$2
65- local plugin_path=$( get_plugin_path $plugin_name )
66- check_if_plugin_exists $plugin_name
68+ local plugin_path
69+ plugin_path=$( get_plugin_path " $plugin_name " )
70+ check_if_plugin_exists " $plugin_name "
6771
6872
69- IFS=' :' read -a version_info <<< " $full_version"
73+ IFS=' :' read -r - a version_info <<< " $full_version"
7074 if [ " ${version_info[0]} " = " ref" ]; then
7175 local install_type=" ${version_info[0]} "
7276 local version=" ${version_info[1]} "
@@ -76,8 +80,10 @@ install_tool_version() {
7680 fi
7781
7882
79- local install_path=$( get_install_path $plugin_name $install_type $version )
80- local concurrency=$( get_concurrency)
83+ local install_path
84+ install_path=$( get_install_path " $plugin_name " " $install_type " " $version " )
85+ local concurrency
86+ concurrency=$( get_concurrency)
8187 trap ' handle_cancel $install_path' INT
8288
8389 if [ -d " $install_path " ]; then
@@ -94,7 +100,7 @@ install_tool_version() {
94100
95101 local exit_code=$?
96102 if [ $exit_code -eq 0 ]; then
97- reshim_command $plugin_name $full_version
103+ reshim_command " $plugin_name " " $full_version "
98104 else
99105 handle_failure " $install_path "
100106 fi
0 commit comments