-
Notifications
You must be signed in to change notification settings - Fork 540
Document deprecation of $env.NU_LIB_DIRS #2101
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
base: main
Are you sure you want to change the base?
Conversation
The $env.NU_LIB_DIRS has been marked deprecated in the nushell source code for a while now, by default it is an empty list to maintain compatibility. Users should prefer the constant $NU_LIB_DIRS instead, which is populated with some things based on environment variables at nushell startup. The docs had drifted a bit. This commit serves to update them.
|
@ysthakur are you able to take a look? |
|
Sorry, slipped my mind. Yes, I'll take a look today or tomorrow |
ysthakur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, thanks for improving our docs. Just some minor comments
|
|
||
| ### `$env.NU_LIB_DIRS` | ||
|
|
||
| ::: note |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ::: warning works better here
| - `$env.XDG_DATA_HOME`: If this environment variable is set, Nushell sets the `$nu.data-dir` constant to `($env.XDG_DATA_HOME)/nushell`. The `data-dir` is used in several startup tasks: | ||
|
|
||
| - `($nu.data-dir)/completions` is added to the `$env.NU_LIB_DIRS` search path. | ||
| - `($nu.data-dir)/completions` is added to the `const` variable `$NU_LIB_DIRS` search path. (Note: `$env.NU_LIB_DIRS` is not populated by default and is currently deprecated. See [Special Variables - `$env.NU_LIB_DIRS`](./special_variables.md#env-NU_LIB_DIRS).) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the entire note is necessary, but it can't hurt. A link to the $NU_LIB_DIRS docs would be helpful though
| - `($nu.data-dir)/completions` is added to the `const` variable `$NU_LIB_DIRS` search path. (Note: `$env.NU_LIB_DIRS` is not populated by default and is currently deprecated. See [Special Variables - `$env.NU_LIB_DIRS`](./special_variables.md#env-NU_LIB_DIRS).) | |
| - `($nu.data-dir)/completions` is added to the `const` variable [`$NU_LIB_DIRS`](./special_variables.md#NU_LIB_DIRS). (Note: `$env.NU_LIB_DIRS` is not populated by default and is currently deprecated. See [Special Variables - `$env.NU_LIB_DIRS`](./special_variables.md#env-NU_LIB_DIRS).) |
| ::: important Important! Importing modules from `$env.NU_LIB_DIRS` | ||
| When importing a module via a relative path, Nushell first searches from the current directory. If a matching module is not found at that location, Nushell then searches each directory in the `$env.NU_LIB_DIRS` list. | ||
| ::: important Important! Importing modules from `$NU_LIB_DIRS` or `$env.NU_LIB_DIRS` | ||
| When importing a module via a relative path, Nushell first searches from the current directory. If a matching module is not found at that location, Nushell then searches each directory in the constant `$NU_LIB_DIRS` list, and then `$env.NU_LIB_DIRS`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super important, but if possible, it'd be good to put a "(deprecated)" when the env var is mentioned.
| When importing a module via a relative path, Nushell first searches from the current directory. If a matching module is not found at that location, Nushell then searches each directory in the constant `$NU_LIB_DIRS` list, and then `$env.NU_LIB_DIRS`. | |
| When importing a module via a relative path, Nushell first searches from the current directory. If a matching module is not found at that location, Nushell then searches each directory in the constant `$NU_LIB_DIRS` list, and then `$env.NU_LIB_DIRS` (deprecated). |
If you choose to do this, the Plugins overview also has a mention of $env.NU_LIB_DIRS
Sorry I took a bit longer to draft these changes, I'm going to blame the holiday spirit for my laziness :)
See #2096 for some context.
I went through the docs to see where else the variables in question were mentioned and I updated them. I'm not competent to maintain the other translations, I'm afraid.
I'm also not sure if I got the hyperlinks and the formatting right - those in the know will have to guide me. I tried cargo-culting from other examples.