plugin path for $nu (#398)

This commit is contained in:
Fernando Herrera 2021-12-02 06:35:32 +00:00 committed by GitHub
parent 45eba8b922
commit 99de2b1d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -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"]

View File

@ -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"] }
chrono = { version="0.4.19", features=["serde"] }
[features]
plugin = []

View File

@ -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 })