nushell/crates/nu-cmd-lang/src
Bahex 79f19f2fc7
Enable conditional source and use patterns by allowing null as a no-op module (#14773)
Related:
- #14329
- #13872
- #8214

# Description & User-Facing Changes

This PR allows enables the following uses, which are all no-op.
```nushell
source null
source-env null
use null
overlay use null
```

The motivation for this change is conditional sourcing of files. For
example, with this change `login.nu` may be deprecated and replaced with
the following code in `config.nu`
```nushell
const login_module = if $nu.is-login { "login.nu" } else { null }
source $login_module
```

# Tests + Formatting
I'm hoping for CI to pass 😄

# After Submitting
Add a part about the conditional sourcing pattern to the website.
2025-01-09 06:37:27 -06:00
..
core_commands Enable conditional source and use patterns by allowing null as a no-op module (#14773) 2025-01-09 06:37:27 -06:00
default_context.rs Remove lazy records (#12682) 2024-05-03 08:36:10 +08:00
example_support.rs Add run-time type checking for command pipeline input (#14741) 2025-01-08 23:09:47 +01:00
example_test.rs remove def-env and export def-env (#10999) 2023-11-19 23:25:09 +08:00
lib.rs Start to Add WASM Support Again (#14418) 2024-11-30 07:57:11 -06:00