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

Support for alias command? #499

Closed
HerbCSO opened this issue Mar 25, 2019 · 2 comments
Closed

Support for alias command? #499

HerbCSO opened this issue Mar 25, 2019 · 2 comments

Comments

@HerbCSO
Copy link
Contributor

HerbCSO commented Mar 25, 2019

Steps to reproduce

I've just started the process of switching to asdf from rbenv/jenv/rustup and co. - mostly because shell startup times with loading all these version managers was getting kinda ridiculously slow and asdf is nice and fast - yay! The information on how to enable legacy version files (setting legacy_version_file = yes in ~/.asdfrc was very helpful, and I was glad to see support for that (although it would be nice if it could be made more prominent in the "Getting Started" section for newcomers like myself).

However, I'm running into a slight niggle with the legacy version support in that the versions that things like jenv provide don't map neatly to what for example the java plugin supports. E.g. jenv knows about a 1.8 alias, which I currently have mapped to 1.8.0.181, and that in turn points to the actual version of oracle64-1.8.0.181 (yeah, I know, I'm a little behind ;] ). So my .java-versions file points to 1.8 and that all works fine under jenv. Now I'd like to make that work in the asdf java plugin, but I don't really see a good mechanism to do so (aside from the fact that I needed to add a list-legacy-filenames to the plugin, but that's beside the point here).

I've thought about adding a parse-legacy-file command to the java plugin, and that works - a working (not particularly good) example for this particular case would be:

#!/usr/bin/env bash
parse_legacy_version() {
  local version=$(cat $1)
  case $version in
    1\.8)
      echo "oracle-8.202"
      ;;
    *)
  esac
}

parse_legacy_version $1

However this seems a bit convoluted for what seems to be a simple use case.

A better way that also seems to work is to add the alias manually by running something like ln -s ~/.asdf/installs/java/oracle-8.202 ~/.asdf/installs/java/1.8 (yeah, I went and upgraded to a newer version while I was at it ;] ). This is reasonable but slightly annoying for what seems like it would be a common use case. Also, I'm not 100% certain yet that this would work for all use cases.

Expected behavior

There should be support for an alias command of some sort like jenv does automatically or like the rbenv-aliases plugin.

Actual behavior

Need to manually create the alias (yeah, I know, woe is me, this is kinda whiny ;] ).

Environment

OS: macOS Sierra 10.12.6

asdf version: 0.7.0

@Stratus3D
Copy link
Member

I think this is related to #352, though it's not an exact duplicate.

@HerbCSO
Copy link
Contributor Author

HerbCSO commented Mar 26, 2019

Thanks so much for the quick response!

Yes, #352 does look very much like it, and after reading the very considered discussion there I very much agree with the points made and I'm happy to close this issue in favor of #352. Sorry, I only searched specifically for alias before I submitted this and didn't find that issue as a result.

PS: Thanks also for including the reference in the core setup guide! I've fixed a little typo in #501.

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

No branches or pull requests

2 participants