mirror of
https://github.com/nushell/nushell.git
synced 2025-05-12 14:04:25 +02:00
Rename std/core
to std/prelude
(#14962)
`std/core` is always loaded by Nushell during startup, and the commands in it are always available. As such, it's renamed `std/prelude`. `scope modules` and `view files` now show `prelude` in place of `core`.
This commit is contained in:
parent
aa62de78e6
commit
cce12efe48
@ -36,7 +36,11 @@ pub fn load_standard_library(
|
|||||||
// Submodules/subdirectories ... std/<module>/mod.nu
|
// Submodules/subdirectories ... std/<module>/mod.nu
|
||||||
let mut std_submodules = vec![
|
let mut std_submodules = vec![
|
||||||
// Loaded at startup - Not technically part of std
|
// Loaded at startup - Not technically part of std
|
||||||
("mod.nu", "std/core", include_str!("../std/core/mod.nu")),
|
(
|
||||||
|
"mod.nu",
|
||||||
|
"std/prelude",
|
||||||
|
include_str!("../std/prelude/mod.nu"),
|
||||||
|
),
|
||||||
// std submodules
|
// std submodules
|
||||||
("mod.nu", "std/assert", include_str!("../std/assert/mod.nu")),
|
("mod.nu", "std/assert", include_str!("../std/assert/mod.nu")),
|
||||||
("mod.nu", "std/bench", include_str!("../std/bench/mod.nu")),
|
("mod.nu", "std/bench", include_str!("../std/bench/mod.nu")),
|
||||||
@ -81,12 +85,12 @@ pub fn load_standard_library(
|
|||||||
let (block, delta) = {
|
let (block, delta) = {
|
||||||
let source = r#"
|
let source = r#"
|
||||||
# Prelude
|
# Prelude
|
||||||
use std/core *
|
use std/prelude *
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
// Add a placeholder file to the stack of files being evaluated.
|
// Add a placeholder file to the stack of files being evaluated.
|
||||||
// The name of this file doesn't matter; it's only there to set the current working directory to NU_STDLIB_VIRTUAL_DIR.
|
// The name of this file doesn't matter; it's only there to set the current working directory to NU_STDLIB_VIRTUAL_DIR.
|
||||||
let placeholder = PathBuf::from("load std/core");
|
let placeholder = PathBuf::from("load std/prelude");
|
||||||
working_set.files = FileStack::with_file(placeholder);
|
working_set.files = FileStack::with_file(placeholder);
|
||||||
|
|
||||||
let block = parse(
|
let block = parse(
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
use std/assert
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
def banner [] {
|
|
||||||
use std/core
|
|
||||||
assert ((core banner | lines | length) == 16)
|
|
||||||
}
|
|
7
crates/nu-std/tests/test_prelude.nu
Normal file
7
crates/nu-std/tests/test_prelude.nu
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
use std/assert
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
def banner [] {
|
||||||
|
use std/prelude
|
||||||
|
assert ((prelude banner | lines | length) == 16)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user