stdlib: add direnv_leaf_dir function #1046
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose here is so that .envrc files that are invoked via
source_up
can make use of the location of the outermost (leaf?).envrc, specifically its location.
For example, I am using this in a synced folder's top level .envrc:
This lets me move my
.direnv
directories out of the sync, because the syncdirectories are platform-specific but my Dropbox gets used on different CPU
architectures and OSs.
Docs
I didn't add stdlib docs because I didn't see the
direnv_layout_dir
function documented there either. I'm happy to add both.Changelog
Same as with the docs; I can add this to the changelog, just tell me how you want it formatted and I'll update the PR.
Testing
I did not see any obvious place to add tests for the stdlib functions. If there is one, I'll happily add some.