Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make asdf latest more ergonomic by outputting plugin name #1713

Closed
wants to merge 7 commits into from

Conversation

toothbrush
Copy link
Contributor

Summary

I have a friction point: I frequently find myself wanting to query the latest version of a plugin, and subsequently pinning it in my current directory.

At the moment, i have to manually munge the output of asdf latest, because it gives just the version string, but i need to add the plugin's name as a prefix.

Maybe a shell session will illustrate my friction point:

Previously:

$ asdf latest ruby 2
2.7.8
$ asdf latest ruby 2 > .tool-versions
$ # ... pain / manual editing / argh
$ asdf install
ruby 2.7.8 installed

After this change:

$ echo "version_with_plugin_name = yes" > ~/.asdfrc
$ asdf latest ruby 2
ruby 2.7.8
$ asdf latest ruby 2 > .tool-versions
$ asdf install
ruby 2.7.8 installed
$ # no pain!

Other Information

By default, the behaviour of asdf latest is unchanged. However, i've introduced a config option version_with_plugin_name & documentation to opt into my proposed new behaviour. This should make the transition seamless and non-breaking for those that want it. I'm happy to modify the name of the config option to something clearer.

This is an improved version of #1704.

On first run, the /tmp folder doesn't exist.  Using mkdir -p would be
harmless and squashes this warning.
I frequently find myself wanting to query the latest version of a thing,
and subsequently pinning it in my current repository.

At the moment, i have to manually munge the output, which is just the
version string, to be prefixed by the plugin name.

Previously:

```
$ asdf latest ruby 2
2.7.8
$ asdf latest ruby 2 >> .tool-versions
$ # ... pain / manual editing / argh
$ asdf install
ruby 2.7.8 installed
```

After this change:

```
$ asdf latest ruby 2
ruby 2.7.8
$ asdf latest ruby 2 >> .tool-versions
$ # no pain!
$ asdf install
ruby 2.7.8 installed
```
@toothbrush toothbrush requested a review from a team as a code owner January 23, 2024 04:57
@toothbrush toothbrush changed the title Make asdf latest a bit more ergonomic feat: Make asdf latest more ergonomic by outputting plugin name Jan 23, 2024
Seems this breaks a ton of things in the test suite, unfortunately.

This reverts commit c775a70.
@toothbrush
Copy link
Contributor Author

Hm, i've just realised that the latest_command function is used internally in asdf as well... So probably this approach isn't great after all. That's a shame.

I have also learned that asdf local ruby latest:2 would do almost what i want – the only issue there is that it doesn't automatically install missing versions but just exits with an error.

I think i'll close this PR and think about a different approach. Sorry for the noise.

@toothbrush toothbrush closed this Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant