Allow user to get latest lts version without installing it and allow updating local version without installing it
- 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
Given that I run following sequence of commands
```
$ asdf plugin install nodejs
$ asdf install nodejs lts
$ asdf global nodejs lts
$ asdf latest nodejs lts
lts
$ node --version
v18.14.1
```
It would be great that `asdf latest nodejs lts` would not output `lts` but it would actually output the version behind the keyword.
This would help to build automation when we don't yet have dependabot integration with asdf.
One could just check what `asdf latest nodejs lts` would output and create a new pull request with that value 👍
### Describe the proposed solution
If I would install nodejs plugin and ask for latest lts I would want to see the actual version instead of the `lts` string:
```
$ asdf plugin install nodejs
$ asdf latest nodejs lts
18.14.1
```
Simiarly it would be great that one could override the local command to update the local version even if it's not installed:
```
$ asdf local nodejs 18.14.1
version 18.14.1 is not installed for nodejs
```
So eg using --force flag the command above would still succeed:
```
$ asdf local nodejs 18.14.1 --force
```
### Describe similar `asdf` features and why they are not sufficient
The workaround described below will achieve the same thing but it's slow and needlessly installing software that wasn't needed in the CI. I will be doing this for multiple projects everyday and I wouldn't want to waste these resources unless it's the only way 😢.
### Describe other workarounds you've considered
The closed issue #1024 did contain a [workaround](https://github.com/asdf-vm/asdf/issues/1024#issuecomment-1235967107) but it requires installing the nodejs version and is making the github action slower and needlessly wasting resources.
By adding this simple command we would allow scheduled CI actions to skip actually installing the nodejs and just getting the new value instead
```bash
# Use `awk` to split the returned line by white-space and take the 2nd column:
$ asdf current nodejs | awk '{print $2}'
lts
# Resolve the `current` nodejs version:
$ readlink -f $(asdf where nodejs $(asdf current nodejs | awk '{print $2}' )) | awk -F '/' '{print $(NF)}'
16.17.0
# Set the explicitly resolved version locally:
$ asdf local nodejs $(readlink -f $(asdf where nodejs $(asdf current nodejs | awk '{print $2}' )) | awk -F '/' '{print $(NF)}')
```
Contributor guide
Research direction
Start at the `asdf latest` and `asdf local` command entry points, then trace how the `lts` keyword is resolved and how the local-version command checks installation. Use the Node.js examples as acceptance cases: `latest` should print the resolved version without installing it, and `local --force` should accept an uninstalled version. No file or test path is named, so locate the corresponding CLI tests before changing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, shell
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100