asdf-vm/asdf

Support `asdf shell latest:version`

Birdie0 opened this issue · 0 comments

Is your feature request related to a problem? Please describe

asdf local <version> and asdf global <version> support two formats for version setting: <version> (20.0.0) and latest[:<version>] (latest:20), but asdf shell supports only first one.

It's not quite clear why only one command doesn't support latest: prefix making it a bit inconsistent. When switching between versions and relying on prefix you would expect it to work with all three.

Describe the proposed solution

Add support of asdf shell latest[:<version>] so it will be consistent with other two version set commands.

Describe similar asdf features and why they are not sufficient

asdf local and asdf global modify .tool-version file so they're not much of replacement. Shell completion helps but when relying on shell history it still requires manually editing version (ex. asdf shell nodejs 20.0.0 -> asdf shell nodejs 20.1.0).

Describe other workarounds you've considered

Tried wrapping asdf list-all to resolve latest version, it works but quite slow sometimes:

function asdf-shell-latest() {
	asdf shell "$1" "$(asdf list-all "$1" "$2" | tail -n1)"
}

# sets ruby version to 2.7.8 as latest available
asdf-shell-latest ruby 2.7