mirror of
https://github.com/nushell/nushell.git
synced 2025-01-31 02:32:55 +01:00
parent
626b1b99cd
commit
c2aa6c708d
@ -530,6 +530,18 @@ pub fn eval_variable(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// since the env var PWD doesn't exist on all platforms
|
||||||
|
// lets just get the current directory
|
||||||
|
if let Ok(current_dir) = std::env::current_dir() {
|
||||||
|
if let Some(cwd) = current_dir.to_str() {
|
||||||
|
output_cols.push("cwd".into());
|
||||||
|
output_vals.push(Value::String {
|
||||||
|
val: cwd.into(),
|
||||||
|
span,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(home_path) = nu_path::home_dir() {
|
if let Some(home_path) = nu_path::home_dir() {
|
||||||
if let Some(home_path_str) = home_path.to_str() {
|
if let Some(home_path_str) = home_path.to_str() {
|
||||||
output_cols.push("home-path".into());
|
output_cols.push("home-path".into());
|
||||||
@ -540,11 +552,6 @@ pub fn eval_variable(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(cwd) = std::env::var("PWD") {
|
|
||||||
output_cols.push("pwd".into());
|
|
||||||
output_vals.push(Value::String { val: cwd, span })
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Value::Record {
|
Ok(Value::Record {
|
||||||
cols: output_cols,
|
cols: output_cols,
|
||||||
vals: output_vals,
|
vals: output_vals,
|
||||||
|
Loading…
Reference in New Issue
Block a user