Closed aooohan closed 6 months ago
Should the matching version numbers be sorted from smallest to largest in terms of semantics, rather than the current largest to smallest sorting?
Should the matching version numbers be sorted from smallest to largest in terms of semantics, rather than the current largest to smallest sorting?
Descending order is right.
I think there are two issues here:
.
, eg: 21.0.3+9-zulu
PreUse
will it do a prefix match, but either way, it's a trade-off.VersionSort
sorts version numbers by dividing them with .
, and can be extended to divide version numbers with [.+-]
.
- Only when the plugin does not implement
PreUse
will it do a prefix match, but either way, it's a trade-off.
Right!
VersionSort
sorts version numbers by dividing them with.
, and can be extended to divide version numbers with[.+-]
.
I don't like this, the rules for version numbers are a custom behavior of the plugin, and can contain other messy characters as well. I don't want to be restrictive.
For examples:
https://github.com/yanecc/vfox-crystal
vfox install crystal@dev
vfox install crystal@nightly
vfox install crystal@20240420
VersionSort
is currently only used in the use
process. Regardless of what version alias is supported in the plugin, its value is only related to the directory name where the sdk is installed. If the plugin installs the SDK to the same directory name using the 'nightly' alias, VersionSort
indeed cannot accurately represent the version.
Regardless of what version alias is supported in the plugin, its value is only related to the directory name where the sdk is installed.
Indeed, I forgot this and thought wrongly.
The fix is not quite correct; if the following versions are available:
vfox use golang@1.2
will match1.22.2
.Originally posted by @Chance-fyi in https://github.com/version-fox/vfox/issues/224#issuecomment-2071204804