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

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

Open
AnWeber opened this issue May 13, 2024 · 2 comments · May be fixed by #289
Open

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

AnWeber opened this issue May 13, 2024 · 2 comments · May be fixed by #289
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@AnWeber
Copy link
Contributor

AnWeber commented May 13, 2024

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 AnWeber added the enhancement New feature or request label May 13, 2024
@aooohan aooohan added this to the 0.5.3 milestone May 16, 2024
@rgustafson-ie
Copy link

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

@aooohan
Copy link
Member

aooohan commented May 20, 2024

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. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants