mirror of
https://github.com/nushell/nushell
synced 2024-12-28 14:03:09 +00:00
Add aliased command to which output (#2894)
* Add aliased command to which output * Fix alias arguments not being displayed
This commit is contained in:
parent
99117ff2ef
commit
363dc51ba0
2 changed files with 17 additions and 3 deletions
|
@ -61,7 +61,21 @@ fn get_entries_in_aliases(scope: &Scope, name: &str, tag: Tag) -> Vec<Value> {
|
|||
.get_aliases_with_name(name)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.map(|_| create_entry!(name, "Nushell alias", tag.clone(), false))
|
||||
.map(|spans| {
|
||||
spans
|
||||
.into_iter()
|
||||
.map(|span| span.item)
|
||||
.collect::<Vec<String>>()
|
||||
.join(" ")
|
||||
})
|
||||
.map(|alias| {
|
||||
create_entry!(
|
||||
name,
|
||||
format!("Nushell alias: {}", alias),
|
||||
tag.clone(),
|
||||
false
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
trace!("Found {} aliases", aliases.len());
|
||||
aliases
|
||||
|
|
|
@ -17,7 +17,7 @@ fn which_alias_ls() {
|
|||
"alias ls = ls -a; which ls | get path | str trim"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "Nushell alias");
|
||||
assert_eq!(actual.out, "Nushell alias: ls -a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -37,7 +37,7 @@ fn correct_precedence_alias_def_custom() {
|
|||
"def ls [] {echo def}; alias ls = echo alias; which ls | get path | str trim"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "Nushell alias");
|
||||
assert_eq!(actual.out, "Nushell alias: echo alias");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue