Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey @diodonfrost, I just wanted to submit this code (probably need to adapt it to whatever format you want), because I noticed a flaw with the sorting mechanism on Linux. We are currently on 2.2.10 release of vagrant, and you script was grabbing 2.2.9. So, it is a bit hacky, but I think it is giving the best results possible. I tried to solve this a more "ansible" way, but I couldn't figure out a solution to handle it properly.
here is a quick example of why/how it doesn't work
the
set
command comes from this (my blog): https://blog.elreydetoda.site/cool-shell-tricks/#bashscriptingmodifiedscripthardening and helps prevent thing from being undefined and more explanation in my blog post.this assigns everything from stdin to an array value, and I got it from here: https://github.com/koalaman/shellcheck/wiki/SC2207
IFS=" " read -r -a arrayzz
then the next line reads in that previously assigned array and sorts the values in the array with the latest value being at the top. So, then at the end you print out the first value in the array. which should be the latest release. got it from here, and modified it a bit to suit my sorting needs. Better explained here
then you just print out that version so it gets put in the register