nushell/crates/nu-command/tests/commands
Antoine Stevan a1f989caf9
change the output of which to be more explicit (#9646)
related to
- https://github.com/nushell/nushell/issues/9637#issuecomment-1629387548

# Description
this PR changes the output of `which` from `table<arg: string, path:
string, built-in: bool> (stream)` to `table<command: string, path:
string, type: string> (stream)`.
- `command`: same as `arg` but more explicit name
- `path`: same as before, `null` when built-in
- `type`: instead of `buil-in: bool` says if it's a `built-in` a
`custom` command, an `alias` or an `external`

# User-Facing Changes
the output of `which` has changed

## some examples
```nushell
> which open
╭───┬─────────┬──────┬──────────╮
│ # │ command │ path │   type   │
├───┼─────────┼──────┼──────────┤
│ 0 │ open    │      │ built-in │
╰───┴─────────┴──────┴──────────╯
```
```nushell
> alias foo = print "foo"
> which foo
╭───┬─────────┬──────┬───────╮
│ # │ command │ path │ type  │
├───┼─────────┼──────┼───────┤
│ 0 │ foo     │      │ alias │
╰───┴─────────┴──────┴───────╯
```
```nushell
> def bar [] {}
> which bar
╭───┬─────────┬──────┬────────╮
│ # │ command │ path │  type  │
├───┼─────────┼──────┼────────┤
│ 0 │ bar     │      │ custom │
╰───┴─────────┴──────┴────────╯
```
```nushell
> which git
╭───┬─────────┬──────────────┬──────────╮
│ # │ command │     path     │   type   │
├───┼─────────┼──────────────┼──────────┤
│ 0 │ git     │ /usr/bin/git │ external │
╰───┴─────────┴──────────────┴──────────╯
```
```nushell
> which open git foo bar
╭───┬─────────┬──────────────┬──────────╮
│ # │ command │     path     │   type   │
├───┼─────────┼──────────────┼──────────┤
│ 0 │ open    │              │ built-in │
│ 1 │ git     │ /usr/bin/git │ external │
│ 2 │ foo     │              │ alias    │
│ 3 │ bar     │              │ custom   │
╰───┴─────────┴──────────────┴──────────╯
```

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
-  `toolkit test`
-  `toolkit test stdlib`

# After Submitting
mention that in the release note
2023-07-20 19:10:53 -05:00
..
assignment Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
date Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
hash_ Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
math Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
move_ Fix cp -u/mv -u when the dst doesn't exist (#9662) 2023-07-12 18:12:59 +02:00
network Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
path Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
platform Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
query Feature cleanup (#7182) 2022-11-22 16:58:11 -08:00
random Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
skip Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
str_ Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
take Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
url Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
alias.rs split $nu variable into scope commands and simpler $nu (#9487) 2023-06-21 09:33:01 +12:00
all.rs Removes unnecessary cwd and pipeline from various tests (#9202) 2023-05-17 18:55:26 -05:00
any.rs Removes unnecessary cwd and pipeline from various tests (#9202) 2023-05-17 18:55:26 -05:00
append.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
break_.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
cal.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
cd.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
compact.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
continue_.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
cp.rs Fix cp -u/mv -u when the dst doesn't exist (#9662) 2023-07-12 18:12:59 +02:00
def.rs Custom command input/output types (#9690) 2023-07-15 09:51:28 +12:00
default.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
do_.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
drop.rs Input output checking (#9680) 2023-07-14 15:20:35 +12:00
each.rs REFACTOR: move the 0% commands to nu-cmd-extra (#9404) 2023-07-06 08:31:31 -07:00
echo.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
empty.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
error_make.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
every.rs fix(nu-command/tests): further remove unnecessary pipeline() and cwd() (#8793) 2023-04-07 14:09:55 -07:00
exec.rs Add "fall-through" signatures (#7527) 2022-12-22 00:33:26 +02:00
export_def.rs Removes unnecessary cwd and pipeline from various tests (#9202) 2023-05-17 18:55:26 -05:00
fill.rs Removes unnecessary cwd and pipeline from various tests (#9202) 2023-05-17 18:55:26 -05:00
find.rs Fix find puts extra cols into record (#9397) 2023-06-10 16:57:26 -05:00
first.rs simplify the nu! tests for last and first commands (#9608) 2023-07-05 12:30:53 +02:00
flatten.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
for_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
format.rs Fix warnings and old names (#8457) 2023-03-15 18:54:55 +13:00
get.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
glob.rs Fix warnings and old names (#8457) 2023-03-15 18:54:55 +13:00
group_by.rs Change group-by to accept cell paths (#9020) 2023-05-17 18:34:44 -05:00
headers.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
help.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
histogram.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
insert.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
inspect.rs throw an error instead of a panic if no input is provided to inspect (#9259) 2023-05-22 13:54:04 -05:00
into_filesize.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
into_int.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
join.rs Removes unnecessary cwd and pipeline from various tests (#9202) 2023-05-17 18:55:26 -05:00
last.rs Input output checking (#9680) 2023-07-14 15:20:35 +12:00
length.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
let_.rs remove warning: unused import pipeline (#9675) 2023-07-13 09:12:20 -07:00
lines.rs Replace row conditions with closures in commands (#7428) 2022-12-10 19:24:06 +02:00
loop_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
ls.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
match_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
merge.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
mkdir.rs Input output checking (#9680) 2023-07-14 15:20:35 +12:00
mod.rs REFACTOR: move the 0% commands to nu-cmd-extra (#9404) 2023-07-06 08:31:31 -07:00
mut_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
nu_check.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
open.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
par_each.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
parse.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
prepend.rs Fix warnings and old names (#8457) 2023-03-15 18:54:55 +13:00
print.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
range.rs Use 'table' on scripts and -c commands (#4377) 2022-02-09 05:58:54 -05:00
redirection.rs Support variables/interpolation in o>, e>, o+e> redirect (#9747) 2023-07-20 13:56:46 +02:00
reduce.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
reject.rs Slim down tests (#9021) 2023-04-28 13:25:44 +02:00
rename.rs Input output checking (#9680) 2023-07-14 15:20:35 +12:00
return_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
reverse.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
rm.rs fix removing symlinks on windows (#9704) 2023-07-20 20:16:03 +02:00
roll.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
rotate.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
run_external.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
save.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
select.rs Fix select on empty lists (#8651) 2023-03-28 12:40:29 -07:00
semicolon.rs Slim down tests (#9021) 2023-04-28 13:25:44 +02:00
seq_char.rs Slim down tests (#9021) 2023-04-28 13:25:44 +02:00
seq.rs Slim down tests (#9021) 2023-04-28 13:25:44 +02:00
sort_by.rs Input output checking (#9680) 2023-07-14 15:20:35 +12:00
sort.rs Slim down tests (#9021) 2023-04-28 13:25:44 +02:00
source_env.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
split_by.rs Fix warnings and old names (#8457) 2023-03-15 18:54:55 +13:00
split_column.rs Add regex separators for split row/list/column (#8707) 2023-04-07 06:46:11 -05:00
split_row.rs Add regex separators for split row/list/column (#8707) 2023-04-07 06:46:11 -05:00
table.rs sync default config / env with default behaviour without any configuration (#9676) 2023-07-18 11:22:00 -05:00
to_text.rs Make to text stream ListStreams (#7577) 2022-12-22 16:38:07 -08:00
touch.rs Correction bug multiple dots mkdir and touch (#8486) 2023-04-05 20:22:56 +03:00
transpose.rs Slim down tests (#9021) 2023-04-28 13:25:44 +02:00
try_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
uniq_by.rs Slim down tests (#9021) 2023-04-28 13:25:44 +02:00
uniq.rs Slim down tests (#9021) 2023-04-28 13:25:44 +02:00
update.rs make insert, update, upsert support lazy records (#9323) 2023-05-31 06:27:55 -05:00
upsert.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
use_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
where_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
which.rs change the output of which to be more explicit (#9646) 2023-07-20 19:10:53 -05:00
while_.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
with_env.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
wrap.rs Fix warnings and old names (#8457) 2023-03-15 18:54:55 +13:00
zip.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00