Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: latest version returns latest version #1996

Merged
merged 5 commits into from
Mar 3, 2025

Conversation

andrecloutier
Copy link
Contributor

@andrecloutier andrecloutier commented Feb 28, 2025

Summary

Adjusting the filter to align with what the bash version of the application does here: https://github.com/andrecloutier/asdf/blob/d7e0740461a26bd3d437c2bfb02619d7e20d2489/lib/functions/versions.bash#L159

Effectively this code misses grep -E "^\\s*[0-9]" when filtering the results from list-all.

Fixes: #1904
Fixes: #1875

Other Information

@andrecloutier andrecloutier force-pushed the fix_latest_version_parsing branch from 5e95bbd to 46d3f42 Compare February 28, 2025 05:27
@andrecloutier andrecloutier marked this pull request as ready for review February 28, 2025 15:35
@andrecloutier andrecloutier requested a review from a team as a code owner February 28, 2025 15:35
@@ -359,10 +362,11 @@ func filterByExactMatch(allVersions []string, pattern string) (versions []string
return versions
}

func filterOutByRegex(allVersions []string, pattern string) (versions []string) {
func filterOutByRegex(allVersions []string, pattern string, keepMatch bool) (versions []string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this function now accepts a keepMatch bool maybe we should rename this function to filterByRegex?

plugin := plugins.New(conf, pluginName)
version, err := Latest(plugin, "")
assert.Nil(t, err)
assert.Equal(t, tt.expectedOutput, version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding tests for this ❤️

@Stratus3D Stratus3D merged commit 0ceac7a into asdf-vm:master Mar 3, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants