asdf icon indicating copy to clipboard operation
asdf copied to clipboard

Export plugin installed name as variable

Open augustobmoura opened this issue 4 years ago • 3 comments

Export the installed name of the plugin for using in scripts. Plugins can have different installed name than it's official, so is safer to get it from a variable than assume a constant.

Maybe ASDF_PLUGIN_NAME?

I can work on this PR giving it's okay to add it, it should be trivial

augustobmoura avatar Oct 02 '20 14:10 augustobmoura

Is there any specific use-case for having the plugin name in a variable?

Incase what you are referring to as plugin name is the plugin dir name, then there is ASDF_INSTALL_PATH which has the install path of the plugin.

HashNuke avatar Oct 07 '20 02:10 HashNuke

Yes, I need to recursively install a different version in a install script, see the install_aliased_version function at https://github.com/asdf-vm/asdf-nodejs/pull/176. When installing a alias version I install the canon version and symlink the alias to it.

So I need to install other version for the same plugin (here is the need for the installed plugin name): asdf install $PLUGIN_NAME $CANON_VERSION

then link the asdf where of the canon version to the install_path: ln -s $(asdf where $PLUGIN_NAME $CANON_VERSION) $ASDF_INSTALL_PATH

asdf-node already has a workaround exactly for this need https://github.com/asdf-vm/asdf-nodejs/blob/de913469365d42938a041d00e534a4f9d13a5b4b/lib/utils.sh#L3

augustobmoura avatar Oct 08 '20 15:10 augustobmoura

@augustobmoura you shouldn't be calling asdf commands from inside a plugin's callback script, however I understand why you are doing it. symlinking one version directory to another is definitely not something that is supported and asdf core could break your code at any time.

I have no objection to adding a ASDF_PLUGIN_NAME variable but I'm not sure it's necessary.

Stratus3D avatar Jun 03 '22 13:06 Stratus3D