asdf-vm / asdf-vm/asdf

Support `asdf shell latest:version`

Open
#1,649 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
25.6k
Forks
941
Avg merge
9h 24m
Merged PRs (30d)
3

Description

### Is your feature request related to a problem? Please describe

`asdf local ` and `asdf global ` support two formats for version setting: `` (`20.0.0`) and `latest[:]` (`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[:]` 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:

```bash
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
```

Contributor guide

Open the contributing guide

Research direction

Start at the `asdf shell` command entry point and compare its version handling with `asdf local` and `asdf global`; use the `asdf list-all` behavior described in the issue as the reference for resolving `latest[:]`. Verify that `asdf shell` accepts both version forms and applies the selected version only to the current shell.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.