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
feat: asdf latest defer to plugin to determine the latest version #938
Conversation
If the command `latest-stable` exists in the plugin, `asdf latest` defers to it to determine the latest stable version. Fixes asdf-vm#763
I have opened this pull request which solves an existing issue about three weeks ago, but it has gotten no attention since then. Is there anything missing or anything I can do so it can be taken in consideration? :( |
@threkk Sorry mate, will look at this in the next couple of days. We appreciate the help and this PR isn't going unnoticed. Sometimes I don't look at a PR until I know I have enough time to give it attention. Which these past few weeks hasn't been much time at all. Will look at this next. |
@Stratus3D I am confident the changes here so will push through. I will clean up the testing in a future PR as we need to test most of the code against 2 different plugins, ones with the minimum scripts and another with all optional scripts like Additionally, I will PR some docs updates about plugin API. We're currently handling calling out to scripts from plugins in different ways, expecting different results, eg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for taking it in consideration. This will also allow me to finish a plug-in I was working on too :) |
exit 1 | ||
|
||
if [ -f "${plugin_path}/bin/latest-stable" ]; then | ||
versions=$(bash "${plugin_path}"/bin/latest-stable "$query") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI at some point hopefully in the near future I'd like to explore allowing callbacks to be written in any language and not just bash. We'd need to change the callback invocations from bash "${plugin_path}"/bin/<callback> <args>
to just "${plugin_path}"/bin/<callback> <args>
. This will give plugin creators more control over how they implement callbacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! It sounds good. I don't mind to look into it when the time comes.
else | ||
# pattern from xxenv-latest (https://github.com/momo-lab/xxenv-latest) | ||
versions=$(asdf list-all "$plugin_name" "$query" | | ||
grep -vE "(^Available versions:|-src|-dev|-latest|-stm|[-\\.]rc|-alpha|-beta|[-\\.]pre|-next|(a|b|c)[0-9]+|snapshot|master)" | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this isn't a new change, but I think Available versions
could be left out of this list. Plugins should just be printing the list of available versions and nothing else. An Available versions
heading is not what is specified in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I decided to leave it as it was purely for backward compatibility, just in case someone relied on it.
@jthegedus thank you for handling. I am sorry I dropped the ball on this. @threkk thank you for this PR! I'd been meaning to implement this on my own for months now, this is a great improvement! |
Summary
If the command
latest-stable
exists in the plugin,asdf latest
defers to it to determine the latest stable version.Fixes: #763
Resolution of #648 now falls to plugin authors.