diff --git a/Cargo.toml b/Cargo.toml index e2d90721e1..2be750d398 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ ctrlc = "3.2.1" # mimalloc = { version = "*", default-features = false } [features] -plugin = ["nu-plugin", "nu-parser/plugin", "nu-command/plugin", "nu-protocol/plugin"] +plugin = ["nu-plugin", "nu-parser/plugin", "nu-command/plugin", "nu-protocol/plugin", "nu-engine/plugin"] dataframe = ["nu-command/dataframe"] default = ["plugin"] diff --git a/crates/nu-engine/Cargo.toml b/crates/nu-engine/Cargo.toml index 4d0c894617..50e2136c3c 100644 --- a/crates/nu-engine/Cargo.toml +++ b/crates/nu-engine/Cargo.toml @@ -5,7 +5,10 @@ edition = "2018" [dependencies] nu-parser = { path = "../nu-parser" } -nu-protocol = { path = "../nu-protocol" } +nu-protocol = { path = "../nu-protocol", features = ["plugin"] } nu-path = { path = "../nu-path" } itertools = "0.10.1" -chrono = { version="0.4.19", features=["serde"] } \ No newline at end of file +chrono = { version="0.4.19", features=["serde"] } + +[features] +plugin = [] diff --git a/crates/nu-engine/src/eval.rs b/crates/nu-engine/src/eval.rs index 59c421427d..359e344049 100644 --- a/crates/nu-engine/src/eval.rs +++ b/crates/nu-engine/src/eval.rs @@ -507,6 +507,17 @@ pub fn eval_variable( }); } + #[cfg(feature = "plugin")] + if let Some(path) = &engine_state.plugin_signatures { + if let Some(path_str) = path.to_str() { + output_cols.push("plugin-path".into()); + output_vals.push(Value::String { + val: path_str.into(), + span, + }); + } + } + if let Ok(cwd) = std::env::var("PWD") { output_cols.push("pwd".into()); output_vals.push(Value::String { val: cwd, span })