Add env.nu file for environment config (#5099)

* Add env.nu file for environment config

* Add missing flag

* Add $nu.env-path variable

Prints `env.nu` path

* Add example of adding entries to PATH
This commit is contained in:
Jakub Žádník
2022-04-06 20:11:51 +03:00
committed by GitHub
parent c3bed1352a
commit 12d3e4e424
5 changed files with 126 additions and 76 deletions

View File

@ -1142,6 +1142,7 @@ pub fn eval_variable(
if let Some(mut config_path) = nu_path::config_dir() {
config_path.push("nushell");
let mut env_config_path = config_path.clone();
let mut history_path = config_path.clone();
@ -1160,6 +1161,14 @@ pub fn eval_variable(
val: config_path.to_string_lossy().to_string(),
span,
});
env_config_path.push("env.nu");
output_cols.push("env-path".into());
output_vals.push(Value::String {
val: env_config_path.to_string_lossy().to_string(),
span,
});
}
#[cfg(feature = "plugin")]