Customizable location for .tool-versions
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 941
- Avg merge
- 9h 24m
- Merged PRs (30d)
- 3
Description
### 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.
Contributor guide
Research direction
Start with lib/commands/command-current.bash and trace how asdf current searches for .tool-versions, including ASDF_DEFAULT_TOOL_VERSIONS_FILENAME and ASDF_DIR. Compare the proposed environment-variable options and verify the chosen behavior for writing and finding the file, including asdf current [plugin]; done means the project location works without changing the default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100