forked from extern/nushell
Break up interdependencies of command crates (#9429)
# Description Make sure that our different crates that contain commands can be compiled in parallel. This can under certain circumstances accelerate the compilation with sufficient multithreading available. ## Details - Move `help` commands from `nu-cmd-lang` back to `nu-command` - This also makes sense as the commands are implemented in an ANSI-terminal specific way - Make `nu-cmd-lang` only a dev dependency for `nu-command` - Change context creation helpers for `nu-cmd-extra` and `nu-cmd-dataframe` to have a consistent api used in `src/main.rs`:`get_engine_state()` - `nu-command` now indepedent from `nu-cmd-extra` and `nu-cmd-dataframe` that are now dependencies of `nu` directly. (change to internal features) - Fix tests that previously used `nu-command::create_default_context()` with replacement functions ## From scratch compilation times: just debug (dev) build and default features ``` cargo clean --profile dev && cargo build --timings ``` ### before  ### after  # User-Facing Changes None direct, only change to compilation on multithreaded jobs expected. # Tests + Formatting Tests that previously chose to use `nu-command` for their scope will still use `nu-cmd-lang` + `nu-command` (command list in the granularity at the time)
This commit is contained in:
committed by
GitHub
parent
b14bdd865f
commit
46eebc644c
@ -1,15 +1,10 @@
|
||||
use nu_protocol::engine::{EngineState, StateWorkingSet};
|
||||
|
||||
use crate::*;
|
||||
#[cfg(feature = "dataframe")]
|
||||
use nu_cmd_dataframe::*;
|
||||
|
||||
#[cfg(feature = "extra")]
|
||||
use nu_cmd_extra::*;
|
||||
|
||||
pub fn create_default_context() -> EngineState {
|
||||
let mut engine_state = nu_cmd_lang::create_default_context();
|
||||
|
||||
use crate::{
|
||||
help::{HelpAliases, HelpCommands, HelpExterns, HelpModules, HelpOperators},
|
||||
*,
|
||||
};
|
||||
pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {
|
||||
let delta = {
|
||||
let mut working_set = StateWorkingSet::new(&engine_state);
|
||||
|
||||
@ -24,12 +19,6 @@ pub fn create_default_context() -> EngineState {
|
||||
// them only accessible if the correct input value category is used with the
|
||||
// declaration
|
||||
|
||||
#[cfg(feature = "extra")]
|
||||
add_extra_decls(&mut working_set);
|
||||
|
||||
#[cfg(feature = "dataframe")]
|
||||
add_dataframe_decls(&mut working_set);
|
||||
|
||||
// Database-related
|
||||
// Adds all related commands to query databases
|
||||
#[cfg(feature = "sqlite")]
|
||||
@ -138,6 +127,16 @@ pub fn create_default_context() -> EngineState {
|
||||
Sys,
|
||||
};
|
||||
|
||||
// Help
|
||||
bind_command! {
|
||||
Help,
|
||||
HelpAliases,
|
||||
HelpExterns,
|
||||
HelpCommands,
|
||||
HelpModules,
|
||||
HelpOperators,
|
||||
};
|
||||
|
||||
// Debug
|
||||
bind_command! {
|
||||
Ast,
|
||||
|
Reference in New Issue
Block a user