nushell/crates/nu-command/src
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
..
charting revert: move to ahash (#9464) 2023-06-18 15:27:57 +12:00
conversions allow tables to have annotations (#9613) 2023-07-07 11:06:09 +02:00
database Improve type hovers (#9515) 2023-06-29 05:19:48 +12:00
date Update some help examples (#8759) 2023-04-05 18:36:00 -05:00
debug remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
deprecated fix typo in deprecated message: $nu should be $env (#9579) 2023-07-01 17:55:25 +02:00
env remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
experimental fix is-admin example (#9350) 2023-06-03 15:11:14 -05:00
filesystem Replace users with nix crate (#9610) 2023-07-06 00:07:07 +02:00
filters Fix headers command handling of missing values (#9603) 2023-07-06 19:54:59 +02:00
formats REFACTOR: move the 0% commands to nu-cmd-extra (#9404) 2023-07-06 08:31:31 -07:00
generators Document and critically review ShellError variants - Ep. 2 (#8326) 2023-03-06 11:31:07 +01:00
hash move common tools from nu-command to nu-cmd-base (#9455) 2023-06-22 14:45:54 -07:00
help Break up interdependencies of command crates (#9429) 2023-06-14 23:12:55 +02:00
math revert: move to ahash (#9464) 2023-06-18 15:27:57 +12:00
misc REFACTOR: move source out of deprecated commands (#9060) 2023-05-04 00:02:03 +02:00
network Fix: return all headers with the same name from http <method> (#9594) 2023-07-03 10:20:39 -05:00
path allow tables to have annotations (#9613) 2023-07-07 11:06:09 +02:00
platform REFACTOR: move the 0% commands to nu-cmd-extra (#9404) 2023-07-06 08:31:31 -07:00
random Document and critically review ShellError variants - Ep. 3 (#8340) 2023-03-06 18:33:09 +01:00
shells Fix usage for the exit command. (#9450) 2023-06-16 10:09:02 +02:00
strings allow tables to have annotations (#9613) 2023-07-07 11:06:09 +02:00
system fixes which showing aliases as built-in nushell commands (#9580) 2023-07-08 10:48:42 +02:00
viewers nu-table/ Fix indexing issue for table --expand (#9484) 2023-06-20 20:27:00 +12:00
default_context.rs REFACTOR: move the 0% commands to nu-cmd-extra (#9404) 2023-07-06 08:31:31 -07:00
example_test.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
hook.rs cratification: move the bytes command to nu-cmd-extra (#9509) 2023-06-23 12:23:08 -07:00
lib.rs cratification: move the bytes command to nu-cmd-extra (#9509) 2023-06-23 12:23:08 -07:00
progress_bar.rs cp progress bar implementation (#8012) 2023-02-22 11:57:38 -08:00
sort_utils.rs Support passing an empty list to sort, uniq, sort-by, and uniq-by (issue #5957) (#8669) 2023-03-29 19:55:38 -07:00