mirror of
https://github.com/nushell/nushell.git
synced 2025-04-25 05:38:20 +02:00
Move submodules to directory/mod.nu for ergonomics and extensibility
This commit is contained in:
parent
021f91cb72
commit
58b5faf67f
@ -18,19 +18,19 @@ pub fn load_standard_library(
|
|||||||
|
|
||||||
let mut std_files = vec![
|
let mut std_files = vec![
|
||||||
("mod.nu", include_str!("../std/mod.nu")),
|
("mod.nu", include_str!("../std/mod.nu")),
|
||||||
("core.nu", include_str!("../std/core.nu")),
|
("core", include_str!("../std/core/mod.nu")),
|
||||||
("assert.nu", include_str!("../std/assert.nu")),
|
("assert", include_str!("../std/assert/mod.nu")),
|
||||||
("bench.nu", include_str!("../std/bench.nu")),
|
("bench", include_str!("../std/bench/mod.nu")),
|
||||||
("dirs.nu", include_str!("../std/dirs.nu")),
|
("dirs", include_str!("../std/dirs/mod.nu")),
|
||||||
("dt.nu", include_str!("../std/dt.nu")),
|
("dt", include_str!("../std/dt/mod.nu")),
|
||||||
("formats.nu", include_str!("../std/formats.nu")),
|
("formats", include_str!("../std/formats/mod.nu")),
|
||||||
("help.nu", include_str!("../std/help.nu")),
|
("help", include_str!("../std/help/mod.nu")),
|
||||||
("input.nu", include_str!("../std/input.nu")),
|
("input", include_str!("../std/input/mod.nu")),
|
||||||
("iter.nu", include_str!("../std/iter.nu")),
|
("iter", include_str!("../std/iter/mod.nu")),
|
||||||
("log.nu", include_str!("../std/log.nu")),
|
("log", include_str!("../std/log/mod.nu")),
|
||||||
("math.nu", include_str!("../std/math.nu")),
|
("math", include_str!("../std/math/mod.nu")),
|
||||||
("util.nu", include_str!("../std/util.nu")),
|
("util", include_str!("../std/util/mod.nu")),
|
||||||
("xml.nu", include_str!("../std/xml.nu")),
|
("xml", include_str!("../std/xml/mod.nu")),
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut working_set = StateWorkingSet::new(engine_state);
|
let mut working_set = StateWorkingSet::new(engine_state);
|
||||||
@ -51,14 +51,14 @@ pub fn load_standard_library(
|
|||||||
let std_dir = std_dir.to_string_lossy().to_string();
|
let std_dir = std_dir.to_string_lossy().to_string();
|
||||||
let source = r#"
|
let source = r#"
|
||||||
# Prelude
|
# Prelude
|
||||||
use ([ std core.nu ] | path join) *
|
use ([ std core ] | path join) *
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let _ = working_set.add_virtual_path(std_dir, VirtualPath::Dir(std_virt_paths));
|
let _ = working_set.add_virtual_path(std_dir, VirtualPath::Dir(std_virt_paths));
|
||||||
|
|
||||||
// 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("loading stdlib");
|
let placeholder = PathBuf::from("load std/core");
|
||||||
working_set.files = FileStack::with_file(placeholder);
|
working_set.files = FileStack::with_file(placeholder);
|
||||||
|
|
||||||
let block = parse(
|
let block = parse(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use dt.nu [datetime-diff, pretty-print-duration]
|
use dt [datetime-diff, pretty-print-duration]
|
||||||
|
|
||||||
# Print a banner for nushell with information about the project
|
# Print a banner for nushell with information about the project
|
||||||
export def banner [] {
|
export def banner [] {
|
@ -1,19 +1,19 @@
|
|||||||
# std.nu, `used` to load all standard library components
|
# std.nu, `used` to load all standard library components
|
||||||
|
|
||||||
export module core.nu
|
export module core
|
||||||
export module bench.nu
|
export module bench
|
||||||
export module assert.nu
|
export module assert
|
||||||
export module dirs.nu
|
export module dirs
|
||||||
export module dt.nu
|
export module dt
|
||||||
export module formats.nu
|
export module formats
|
||||||
export module help.nu
|
export module help
|
||||||
export module input.nu
|
export module input
|
||||||
export module iter.nu
|
export module iter
|
||||||
export module log.nu
|
export module log
|
||||||
export module math.nu
|
export module math
|
||||||
export module util.nu
|
export module util
|
||||||
export module xml.nu
|
export module xml
|
||||||
export-env {
|
export-env {
|
||||||
use dirs.nu []
|
use dirs []
|
||||||
use log.nu []
|
use log []
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user