Skip to content

Commit d428c04

Browse files
committed
fix get_tool_version_from_file
1 parent 9f99442 commit d428c04

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

lib/utils.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,12 @@ get_asdf_versions_file_path() {
7777

7878

7979
get_preset_version_for() {
80-
local plugin=$1
80+
local tool_name=$1
8181
local asdf_versions_path=$(get_asdf_versions_file_path)
82+
local matching_tool_version=""
8283

8384
if [ "$asdf_versions_path" != "" ]; then
84-
matching_tool_version=$(get_package_version_from_file $asdf_versions_path)
85+
matching_tool_version=$(get_tool_version_from_file $asdf_versions_path $tool_name)
8586
fi
8687

8788

@@ -92,7 +93,7 @@ get_preset_version_for() {
9293
if [ ! -f $global_tool_versions_path ]; then
9394
touch $global_tool_versions_path
9495
else
95-
matching_tool_version=$(get_package_version_from_file $global_tool_versions_path)
96+
matching_tool_version=$(get_tool_version_from_file $global_tool_versions_path $tool_name)
9697
fi
9798
fi
9899

@@ -101,20 +102,20 @@ get_preset_version_for() {
101102
}
102103

103104

104-
get_package_version_from_file() {
105-
local package=$1
106-
local asdf_versions_path=$2
105+
get_tool_version_from_file() {
106+
local asdf_versions_path=$1
107+
local tool_name=$2
107108
local matching_tool_version=""
108109

109110
while read tool_line
110111
do
111112
IFS=' ' read -a tool_info <<< $tool_line
112-
local tool_name=$(echo "${tool_info[0]}" | xargs)
113-
local tool_version=$(echo "${tool_info[1]}" | xargs)
113+
local t_name=$(echo "${tool_info[0]}" | xargs)
114+
local t_version=$(echo "${tool_info[1]}" | xargs)
114115

115-
if [ "$tool_name" = "$plugin" ]
116+
if [ "$t_name" = "$tool_name" ]
116117
then
117-
matching_tool_version=$tool_version
118+
matching_tool_version=$t_version
118119
break;
119120
fi
120121
done < $asdf_versions_path

0 commit comments

Comments
 (0)