Plugin before config (#642)

* Add fuzzy/ignore flag to get

* Handle plugins before config
This commit is contained in:
JT 2022-01-02 14:20:33 +11:00 committed by GitHub
parent f7e3d4de24
commit ffaaa53526
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,