mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 00:43:33 +01:00
Add support for :path
This commit is contained in:
parent
bc309705a9
commit
53911ebecd
@ -589,17 +589,22 @@ impl Command {
|
||||
out.to_output_stream()
|
||||
} else {
|
||||
let nothing = Value::nothing().tagged(Tag::unknown());
|
||||
|
||||
let call_info = raw_args
|
||||
.clone()
|
||||
.call_info
|
||||
.evaluate(®istry, &Scope::it_value(nothing.clone()))
|
||||
.unwrap();
|
||||
.evaluate(®istry, &Scope::it_value(nothing.clone()));
|
||||
|
||||
match command
|
||||
.run(&call_info, ®istry, &raw_args, nothing)
|
||||
.into()
|
||||
{
|
||||
Ok(o) => o,
|
||||
match call_info {
|
||||
Ok(call_info) => {
|
||||
match command
|
||||
.run(&call_info, ®istry, &raw_args, nothing)
|
||||
.into()
|
||||
{
|
||||
Ok(o) => o,
|
||||
Err(e) => OutputStream::one(Err(e)),
|
||||
}
|
||||
}
|
||||
Err(e) => OutputStream::one(Err(e)),
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,18 @@ fn evaluate_reference(
|
||||
let config = crate::data::config::read(tag.clone(), &None)?;
|
||||
Ok(Value::row(config).tagged(tag))
|
||||
}
|
||||
x if x == "nu:path" => {
|
||||
let mut table = vec![];
|
||||
match std::env::var_os("PATH") {
|
||||
Some(paths) => {
|
||||
for path in std::env::split_paths(&paths) {
|
||||
table.push(Value::path(path).tagged(&tag));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
Ok(Value::table(&table).tagged(tag))
|
||||
}
|
||||
x => Ok(scope
|
||||
.vars
|
||||
.get(x)
|
||||
|
Loading…
Reference in New Issue
Block a user