mirror of
https://github.com/nushell/nushell.git
synced 2025-04-16 09:18:21 +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![
|
||||
("mod.nu", include_str!("../std/mod.nu")),
|
||||
("core.nu", include_str!("../std/core.nu")),
|
||||
("assert.nu", include_str!("../std/assert.nu")),
|
||||
("bench.nu", include_str!("../std/bench.nu")),
|
||||
("dirs.nu", include_str!("../std/dirs.nu")),
|
||||
("dt.nu", include_str!("../std/dt.nu")),
|
||||
("formats.nu", include_str!("../std/formats.nu")),
|
||||
("help.nu", include_str!("../std/help.nu")),
|
||||
("input.nu", include_str!("../std/input.nu")),
|
||||
("iter.nu", include_str!("../std/iter.nu")),
|
||||
("log.nu", include_str!("../std/log.nu")),
|
||||
("math.nu", include_str!("../std/math.nu")),
|
||||
("util.nu", include_str!("../std/util.nu")),
|
||||
("xml.nu", include_str!("../std/xml.nu")),
|
||||
("core", include_str!("../std/core/mod.nu")),
|
||||
("assert", include_str!("../std/assert/mod.nu")),
|
||||
("bench", include_str!("../std/bench/mod.nu")),
|
||||
("dirs", include_str!("../std/dirs/mod.nu")),
|
||||
("dt", include_str!("../std/dt/mod.nu")),
|
||||
("formats", include_str!("../std/formats/mod.nu")),
|
||||
("help", include_str!("../std/help/mod.nu")),
|
||||
("input", include_str!("../std/input/mod.nu")),
|
||||
("iter", include_str!("../std/iter/mod.nu")),
|
||||
("log", include_str!("../std/log/mod.nu")),
|
||||
("math", include_str!("../std/math/mod.nu")),
|
||||
("util", include_str!("../std/util/mod.nu")),
|
||||
("xml", include_str!("../std/xml/mod.nu")),
|
||||
];
|
||||
|
||||
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 source = r#"
|
||||
# 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));
|
||||
|
||||
// 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.
|
||||
let placeholder = PathBuf::from("loading stdlib");
|
||||
let placeholder = PathBuf::from("load std/core");
|
||||
working_set.files = FileStack::with_file(placeholder);
|
||||
|
||||
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
|
||||
export def banner [] {
|
@ -1,19 +1,19 @@
|
||||
# std.nu, `used` to load all standard library components
|
||||
|
||||
export module core.nu
|
||||
export module bench.nu
|
||||
export module assert.nu
|
||||
export module dirs.nu
|
||||
export module dt.nu
|
||||
export module formats.nu
|
||||
export module help.nu
|
||||
export module input.nu
|
||||
export module iter.nu
|
||||
export module log.nu
|
||||
export module math.nu
|
||||
export module util.nu
|
||||
export module xml.nu
|
||||
export module core
|
||||
export module bench
|
||||
export module assert
|
||||
export module dirs
|
||||
export module dt
|
||||
export module formats
|
||||
export module help
|
||||
export module input
|
||||
export module iter
|
||||
export module log
|
||||
export module math
|
||||
export module util
|
||||
export module xml
|
||||
export-env {
|
||||
use dirs.nu []
|
||||
use log.nu []
|
||||
use dirs []
|
||||
use log []
|
||||
}
|
Loading…
Reference in New Issue
Block a user