From ffaaa53526ca13064a5a1e02ff19fb85fe6d6a7a Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Sun, 2 Jan 2022 14:20:33 +1100 Subject: [PATCH] Plugin before config (#642) * Add fuzzy/ignore flag to get * Handle plugins before config --- src/main.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main.rs b/src/main.rs index 77cb651731..193284f361 100644 --- a/src/main.rs +++ b/src/main.rs @@ -267,6 +267,24 @@ fn main() -> Result<()> { }, ); + #[cfg(feature = "plugin")] + { + // Reading signatures from signature file + // The plugin.nu file stores the parsed signature collected from each registered plugin + if let Some(mut plugin_path) = nu_path::config_dir() { + // Path to store plugins signatures + plugin_path.push("nushell"); + plugin_path.push("plugin.nu"); + engine_state.plugin_signatures = Some(plugin_path.clone()); + + let plugin_filename = plugin_path.to_string_lossy().to_owned(); + + if let Ok(contents) = std::fs::read_to_string(&plugin_path) { + eval_source(&mut engine_state, &mut stack, &contents, &plugin_filename); + } + } + } + // Load config startup file if let Some(mut config_path) = nu_path::config_dir() { config_path.push("nushell"); @@ -333,24 +351,6 @@ fn main() -> Result<()> { } }); - #[cfg(feature = "plugin")] - { - // Reading signatures from signature file - // The plugin.nu file stores the parsed signature collected from each registered plugin - if let Some(mut plugin_path) = nu_path::config_dir() { - // Path to store plugins signatures - plugin_path.push("nushell"); - plugin_path.push("plugin.nu"); - engine_state.plugin_signatures = Some(plugin_path.clone()); - - let plugin_filename = plugin_path.to_string_lossy().to_owned(); - - if let Ok(contents) = std::fs::read_to_string(&plugin_path) { - eval_source(&mut engine_state, &mut stack, &contents, &plugin_filename); - } - } - } - loop { let config = match stack.get_config() { Ok(config) => config,