nushell/crates/nu-command/src/system
Ayush Singh ad125abf6a
fixes which showing aliases as built-in nushell commands (#9580)
fixes #8577 

# Description
Currently, using `which` on an alias describes it as a nushell built-in
command:
```bash
> alias foo = print "foo!"                                                                                                                                                                                   > which ls foo --all                                                                                                                                                                                        
╭───┬─────┬──────────────────────────┬──────────╮
│ # │ arg │           path           │ built-in │
├───┼─────┼──────────────────────────┼──────────┤
│ 0 │ ls  │ Nushell built-in command │ true     │
│ 1 │ ls  │ /bin/ls                  │ false    │
│ 2 │ foo │ Nushell built-in command │ true     │
╰───┴─────┴──────────────────────────┴──────────╯
```

This PR fixes the behaviour above to the following:
```bash
> alias foo = print "foo!"
> which ls foo --all
╭───┬─────┬──────────────────────────┬──────────╮
│ # │ arg │           path           │ built-in │
├───┼─────┼──────────────────────────┼──────────┤
│ 0 │ ls  │ Nushell built-in command │ true     │
│ 1 │ ls  │ /bin/ls                  │ false    │
│ 2 │ foo │ Nushell alias            │ false    │
╰───┴─────┴──────────────────────────┴──────────╯
```

# User-Facing Changes
Passing in an alias to `which` will no longer return `Nushell built-in
command`, `true` for `path` and `built-in` respectively.

# Tests + Formatting

# After Submitting
2023-07-08 10:48:42 +02:00
..
complete.rs Document and critically review ShellError variants - Ep. 3 (#8340) 2023-03-06 18:33:09 +01:00
exec.rs Add --redirect-combine option to run-external (#8918) 2023-04-28 07:55:48 -05:00
mod.rs relocate debug commands (#8071) 2023-02-13 16:39:07 +00:00
nu_check.rs Only add the std lib files once (#8830) 2023-04-10 08:55:47 +12:00
ps.rs Add ppid example for ps (#8768) 2023-04-06 07:32:12 -05:00
registry_query.rs Use imported names in Command::run signatures (#7967) 2023-02-05 22:17:46 +01:00
run_external.rs revert: move to ahash (#9464) 2023-06-18 15:27:57 +12:00
sys.rs remove unused dependencies (#9230) 2023-05-18 11:37:20 -05:00
which_.rs fixes which showing aliases as built-in nushell commands (#9580) 2023-07-08 10:48:42 +02:00