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

asdf 0.16.0+ asdf shell alternative #1911

Open
KieranP opened this issue Feb 7, 2025 · 4 comments
Open

asdf 0.16.0+ asdf shell alternative #1911

KieranP opened this issue Feb 7, 2025 · 4 comments

Comments

@KieranP
Copy link

KieranP commented Feb 7, 2025

Is your feature request related to a problem? Please describe

Before 0.16.0, it was quite handy to be able to set a version for the current shell session. e.g. for no downtime ruby deployments, I could install the new ruby version, use asdf shell to switch to it without the current shell, and install the required rubygems via bundler before switching our app over to use it.

Describe the proposed solution

Reimplement asdf shell (or asdf set --shell) so that asdf versions can be overwritten for the current shell environment

Describe similar asdf features and why they are not sufficient

With asdf shell gone, the only solution is to use asdf set, which overwrites tool-versions, which means when the application next boots up or scales up automatically, it uses the changed ruby version which might not be ready yet.

Describe other workarounds you've considered

I guess a work around would be to make a new directory, create a tool-versions there, a copy over the Gemfile and Gemfile.lock, but this is cumbersome compared to a quick asdf shell ruby 3.4.1 (or using the new set, asdf set --shell ruby 3.4.1)

@maple3142
Copy link

Since asdf is now a binary instead of a shell function, asdf shell can't modify current shell's environment so it can't work the same way as old version. But I think there is some possible way to introduce similar feature back to 0.16.0+

  1. A new command like asdf session to spawn a new shell with new environment ASDF_XXXX_VERSION=yyyy similar to poetry shell, and possible add a systax to specify different versions to different plugins (e.g. specify both Python version 3.10.12 and Node.js 22.9.0). Avoid asdf shell to avoid confusion because shell variables will not be preserved in new shell.
  2. Introduce an shell wrapper function to the asdf binary, which can be used to implement the old asdf shell functionality.

@davishmcclurg
Copy link

2. Introduce an shell wrapper function to the asdf binary, which can be used to implement the old asdf shell functionality.

I think I prefer this over the asdf session option. I also used asdf shell quite a bit and am sad to see it go.

@socketbox
Copy link

I too miss the functionality of asdf shell and wonder if having a simple command that echoed export ASDF_<plugin-name>_VERSION=x.y.z (as described here) to the terminal would be a nice compromise.

@maple3142
Copy link

A temporary wordaround for zsh users with completion support: https://gist.github.com/maple3142/8333a5732bb200e3a1fbad097e80c9ef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants