asdf-vm/asdf

Customizable location for .tool-versions

zrusilla opened this issue · 1 comments

Is your feature request related to a problem? Please describe

I'd like to be able to explicitly set via the environment where the .tool-versions exists.

My current use case is an automated installation of asdf and plugins to a project workspace, where it should be kept apart from a user's own installation. The .tools-versions gets written and is searched for in $PWD, which means the directory the script is running from.

I would like to ensure it's written to the project space, findable by the installer, as well as by the user if the environment is set correctly. I should be able to see what the installer did with asdf current [plugin].

Describe the proposed solution

I would like location to tool-versions customizable via the environment Some options

  • ASDF_DEFAULT_TOOL_VERSIONS_FILENAME is the full path name
  • .tool-versions is written relative to $ASDF_DIR

I did a small test by replacing $PWD with $(asdf_dir), for example

--- a/lib/commands/command-current.bash
+++ b/lib/commands/command-current.bash
@@ -10,7 +10,7 @@ plugin_current_command() {
   check_if_plugin_exists "$plugin_name"

   local search_path
-  search_path=$PWD
+  search_path=$(asdf_dir)
``

With ASDF_DIR set to my project space, I was able to see the installed plugins with `asdf current`.  This isn't an entirely correct solution since it changes the default location from  where it is currently, but illustrates what I mean.


### Describe similar `asdf` features and why they are not sufficient

ASDF_DEFAULT_TOOL_VERSIONS_FILENAME is only the filename itself.   asdf starts looking for it at $PWD and works its way up the tree.  This may not be correct for the hands-off installation use case.

### Describe other workarounds you've considered

I've fiddled extensively with the environment variable settings
I may need to chdir in my script to get it to write things to the desired locations. 


Related to #1365 and #1553.