mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
604aadc938
# Description For better parallel compilation, make sure that `nu-command` doesn't depend on `nu-explore`. Moves the `nu_protocol::Command` implementation into `nu-explore`. Adds `nu_explore::add_explore_context()` which is used in `main.rs` to add the `explore` command. Minor improvement in compile time ~0.5 sec observed as `nu-command` still blocks on `nu-cmd-lang` as well. ## `cargo build --timings` before ![grafik](https://github.com/nushell/nushell/assets/15833959/583aa56e-6a1e-47b9-ba00-6a86293a38db) ## `cargo build --timings` after ![grafik](https://github.com/nushell/nushell/assets/15833959/30687575-c1c8-4635-bcdd-7ce9488fcfff) # User-Facing Changes None
18 lines
480 B
Rust
18 lines
480 B
Rust
use nu_protocol::engine::{EngineState, StateWorkingSet};
|
|
|
|
use crate::explore::*;
|
|
|
|
pub fn add_explore_context(mut engine_state: EngineState) -> EngineState {
|
|
let delta = {
|
|
let mut working_set = StateWorkingSet::new(&engine_state);
|
|
working_set.add_decl(Box::new(Explore));
|
|
working_set.render()
|
|
};
|
|
|
|
if let Err(err) = engine_state.merge_delta(delta) {
|
|
eprintln!("Error creating explore command context: {err:?}");
|
|
}
|
|
|
|
engine_state
|
|
}
|