mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 11:36:11 +01:00
README: Move explanation of direnv_layout_dir into example implementation
It reads much more clearly in this manner, as the documentation is presented alongside the thing it is documenting
This commit is contained in:
parent
e1df1d7484
commit
1741888b4c
1 changed files with 7 additions and 3 deletions
10
README.md
10
README.md
|
|
@ -219,7 +219,13 @@ The following example will create a unique directory name per project
|
|||
in `$HOME/.cache/direnv/layouts/`:
|
||||
|
||||
```bash
|
||||
# $HOME/.config/direnv/direnvrc
|
||||
# Place in "$HOME"/.config/direnv/direnvrc
|
||||
|
||||
# Two things to know:
|
||||
# * `direnv_layour_dir` is called once for every {.direnvrc,.envrc} sourced
|
||||
# * The indicator for a different direnv file being sourced is a different `$PWD` value
|
||||
# This means we can hash `$PWD` to get a fully unique cache path for any given environment
|
||||
|
||||
: ${XDG_CACHE_HOME:=$HOME/.cache}
|
||||
declare -A direnv_layout_dirs
|
||||
direnv_layout_dir() {
|
||||
|
|
@ -229,8 +235,6 @@ direnv_layout_dir() {
|
|||
)}"
|
||||
}
|
||||
```
|
||||
During direnv setup `direnv_layout_dir` can be called multiple times and with different values of `$PWD`
|
||||
(when other `.envrc` files are included). Therefore cache its results in dictionary `direnv_layout_dirs`.
|
||||
|
||||
## Watching additional files
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue