Skip to content

Commit

Permalink
fix: improve version checking logic in gh-find-code
Browse files Browse the repository at this point in the history
  • Loading branch information
LangLangBart committed Mar 16, 2024
1 parent b765f43 commit 4fb7e4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gh-find-code
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ check_version() {
IFS='.' read -ra ver_parts <<<"$user_version"
IFS='.' read -ra threshold_parts <<<"$threshold"

for i in "${!ver_parts[@]}"; do
if (("${ver_parts[i]}" < "${threshold_parts[i]}")); then
for i in "${!threshold_parts[@]}"; do
if ((i >= ${#ver_parts[@]})) || (("${ver_parts[i]}" < "${threshold_parts[i]}")); then
$on_error "Your '$tool' version '$user_version' is insufficient. The minimum required version is '$threshold'."
elif (("${ver_parts[i]}" > "${threshold_parts[i]}")); then
break
fi
done
}
Expand Down

0 comments on commit 4fb7e4d

Please sign in to comment.