vfox icon indicating copy to clipboard operation
vfox copied to clipboard

[Feature]: support .tool-versions in parent directories

Open AnWeber opened this issue 9 months ago • 2 comments

asdf supports creating a .tool-versions in some directory. These versions are used in this directory and all sub-directories (see)

1. Your usage scenarios?

create following structure

test 
- .tool-versions => nodejs 21.x
- foo 
- - .tool-versions => nodejs 22.x
- bar
- - no tool-versions

If I access ~/test/bar I always want to have Node Versoin 21.x active. At the moment the previous node version is active

image

2. What is your expected outcome?

The idea is that I can automatically activate the respective version for certain folder structures without having to actively maintain this in each directory.

AnWeber avatar May 13 '24 21:05 AnWeber

Relatedly, when no .tools-version is present in the parent directory hierarchy:

   test-parent
   - test
   - .tool-versions => nodejs 21.x

When in test one expects, nodejs 21.x, but when in test-parent one expects node to be missing, but instead it depends on how you've traversed the directories.

So for example, the output of these commands in a new shell is not consist in the test-parent directory:

cd test-parent
node --version 
cd test
node --version
cd ..
node --version

The output is:

shell: node not found
nodejs 21.x
nodejs 21.x

Expecting:

shell: node not found
nodejs 21.x
shell: node not found

rgustafson-ie avatar May 17 '24 15:05 rgustafson-ie

Thank you for such detailed advice!

Related #228.

The current behavior is

if you have a .tool-version in your project (project/.tool-versions), that version will be used in the current shell, regardless of whether you switch directories or not, the version is not changed until the next .tool-versions file is encountered, or vfox use command is executed manually.

Given the need for real users who want this feature, I'm considering aligning vfox to behave as described in the current issue. ;)

aooohan avatar May 20 '24 07:05 aooohan