nushell/crates/nu-cmd-lang/src/core_commands
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
..
overlay Enable conditional source and use patterns by allowing null as a no-op module (#14773) 2025-01-09 06:37:27 -06:00
scope Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
alias.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
break_.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
collect.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
const_.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
continue_.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
def.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
describe.rs Start to Add WASM Support Again (#14418) 2024-11-30 07:57:11 -06:00
do_.rs Add run-time type checking for command pipeline input (#14741) 2025-01-08 23:09:47 +01:00
echo.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
error_make.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
export_alias.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
export_const.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
export_def.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
export_extern.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
export_module.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
export_use.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
export.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
extern_.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
for_.rs Error on non-zero exit statuses (#13515) 2024-09-07 06:44:26 +00:00
hide_env.rs Fix example for hide-env (#14013) 2024-10-06 08:50:11 -05:00
hide.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
if_.rs Error on non-zero exit statuses (#13515) 2024-09-07 06:44:26 +00:00
ignore.rs Start to Add WASM Support Again (#14418) 2024-11-30 07:57:11 -06:00
let_.rs Fix try not working with let, etc. (#13885) 2024-09-23 06:44:25 -05:00
loop_.rs Error on non-zero exit statuses (#13515) 2024-09-07 06:44:26 +00:00
match_.rs Error on non-zero exit statuses (#13515) 2024-09-07 06:44:26 +00:00
mod.rs Remove lazy records (#12682) 2024-05-03 08:36:10 +08:00
module.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
mut_.rs Fix try not working with let, etc. (#13885) 2024-09-23 06:44:25 -05:00
return_.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
try_.rs Add label rendering to try/catch rendered errors (#14477) 2024-11-29 19:02:26 -06:00
use_.rs Enable conditional source and use patterns by allowing null as a no-op module (#14773) 2025-01-09 06:37:27 -06:00
version.rs Start to Add WASM Support Again (#14418) 2024-11-30 07:57:11 -06:00
while_.rs Error on non-zero exit statuses (#13515) 2024-09-07 06:44:26 +00:00