-
Notifications
You must be signed in to change notification settings - Fork 790
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: Auto-install missing versions in asdf local. #1714
base: master
Are you sure you want to change the base?
Conversation
I frequently want to be able to upgrade my `.tool-versions` straight to the newest version of a plugin with the `asdf local` command. At the moment, the first repository i perform this on, i'll get an error that the latest version isn't installed: ```shellsession $ asdf local ruby latest version 3.3.0 is not installed for ruby ❌ ``` Instead of having to read the latest version from the error output, then type, e.g., `asdf install ruby 3.3.0`, then redo my command, i'd like to be able to have `asdf local` do the installation automatically. This will save me a tedious manual step. With this change, i can do it all in one go: ```shellsession $ echo "local_command_auto_install_missing_version = yes" >> .asdfrc $ asdf local ruby latest ...installs Ruby 3.3.0... $ cat .tool-versions ruby 3.3.0 🎉 ```
The maintainer won't add automatic plugin installs because they're disillusioned into thinking this is a security threat, so this -- which is a logical extension of the idea -- is probably going to be rejected. So many of us have wanted this for years. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. Notes below.
- Can we add appropriate tests for this change? The relevant file to do so would be
test/version_commands.bats
- Can we please update this to use a command-line option instead of the configuration file?
asdf local ruby latest --install-missing
I would prefer that the user clearly knows that they are forcing an install.
I haven't tested the PR. I'll do that after the changes are done.
Hey Akash, thanks for your response! Indeed i'm happy to add tests and a command-line flag if you prefer that approach. Before doing the work i think it'd be good to discuss the UX though. My sense is that if we provide both Consider, before the change:
If we add only a
It's true that this is only 2 commands versus 3 separate actions before, but arguably (my personal view, i guess others may disagree) it will actually be harder to remember this Does my concern make sense? From my point of view there's not much value in adding only a CLI flag without support for setting it persistently in
That's a good point. We could consider adding some output such as |
Summary
I frequently want to be able to upgrade my
.tool-versions
straight to the newest version of a plugin with theasdf local
command. At the moment, the first repository i perform this on, i'll get an error that the latest version isn't installed:Instead of having to read the latest version from the error output, then type, e.g.,
asdf install ruby 3.3.0
, then redo my command, i'd like to be able to haveasdf local
do the installation automatically. This will save me a tedious manual step.With this change, i can do it all in one go:
Other Information
Apologies for the PR spam. Hopefully this one will be acceptable. I previously misunderstood a few things about how asdf works under the hood – i think this is a better way to address what i actually wanted, namely less manual version swizzling 😁
Also, i'm happy to find a better name for the config option.