asdf-vm / asdf

Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more
https://asdf-vm.com/
MIT License
21.65k stars 772 forks source link

Feature request: Add easier shell integration with a subcommand that can be used in eval statement #1164

Open onnimonni opened 2 years ago

onnimonni commented 2 years ago

Is your feature request related to a problem? Please describe

There's so many multiple ways to enable asdf for different shells.

For example I'm interested in replacing nodenv with asdf in the company I'm now working.

In our project readme we have now the following steps:

Add the following line to your shell's rc/profile file and restart your shell: eval "$(nodenv init -)"

Which is much cleaner than checking if people are using bash/zsh/fish separately and providing multiple installation steps like we need with asdf.

Describe the proposed solution

Add init subcommand to asdf which prints out the paths or commands that can be added for corresponding shell.

This is how nodenv works:

Example output using fish shell

$ nodenv init
# Load nodenv automatically by appending
# the following to ~/.config/fish/config.fish:

status --is-interactive; and source (nodenv init -|psub)

Example output using bash:

$ nodenv init
# Load nodenv automatically by appending
# the following to ~/.bash_profile:

eval "$(nodenv init -)"

Describe similar asdf features and why they are not sufficient

The third section in getting started page is sufficient but this would make the adoption little bit smoother.

Describe other workarounds you've considered

Pointing people to asdf getting started page from our documentation.

hyperupcall commented 11 months ago

@jthegedus @Stratus3D do either (or both) of you have interest in this? I don't want to implement this if there is no desire for it.

hyperupcall commented 11 months ago

Tackling this would make asdf easier to package for distros. Related to #1343, #666.