nushell/crates/nu-utils
Douglas cf82814606
Use const NU_LIB_DIRS in startup (#14549)
# Description

A slower, gentler alternative to #14531, in that we're just moving one
setting *out* of `default_env.nu` in this PR ;-).

All this does is transition from using `$env.NU_LIB_DIRS` in the startup
config to `const $NU_LIB_DIRS`. Also updates the `sample_env.nu` to
reflect the changes.

Details:

Before: `$env.NU_LIB_DIRS` was unnecessary set both in `main()` and in
`default_env.nu`
After: `$env.NU_LIB_DIRS` is only set in `main()`

Before: `$env.NU_LIB_DIRS` was set to `config-dir/scripts` and
`data-dir/completions`
After: `$env.NU_LIB_DIRS` is set to an empty list, and `const
NU_LIB_DIRS` is set to the directories above

Before: Using `--include-path (-I)` would set the `$env.NU_LIB_DIRS`
After: Using `--include-path (-I)` sets the constant `$NU_LIB_DIRS`

# User-Facing Changes

There shouldn't be any breaking changes here. The `$env.NU_LIBS_DIRS`
still works for most cases. There are a few areas we need to clean-up to
make sure that the const is usable (`nu-check`, et. al.) but they will
still work in the meantime with the older `$env` version.

# Tests + Formatting

* Changed the Type-check on the `$env` version.
* Added a type check for the const version.

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

Doc updates
2024-12-10 06:36:05 -06:00
..
src Use const NU_LIB_DIRS in startup (#14549) 2024-12-10 06:36:05 -06:00
.gitignore added nu-utils crate, fixed issue where externals turn off vt processing (#4857) 2022-03-16 17:21:06 -05:00
Cargo.toml Start to Add WASM Support Again (#14418) 2024-11-30 07:57:11 -06:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00
README.md Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00

Collection of small utilities that are shared across Nushell crates.

This crate should compile early in the crate graph and thus not depend on major dependencies or core-nushell crates itself.

Internal Nushell crate

This crate implements components of Nushell and is not designed to support plugin authors or other users directly.