Skip to content

change the output of which to be more explicit - #9646

Merged
fdncred merged 4 commits into
nushell:mainfrom
amtoine:change-which-table-output
Jul 21, 2023
Merged

fdncred merged 4 commits into
nushell:mainfrom
amtoine:change-which-table-output

Conversation

@amtoine

@amtoine amtoine commented Jul 10, 2023

Copy link
Copy Markdown
Member

related to

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

> which open
╭───┬─────────┬──────┬──────────╮
│ # │ command │ path │   type   │
├───┼─────────┼──────┼──────────┤
│ 0 │ open    │      │ built-in │
╰───┴─────────┴──────┴──────────╯
> alias foo = print "foo"
> which foo
╭───┬─────────┬──────┬───────╮
│ # │ command │ path │ type  │
├───┼─────────┼──────┼───────┤
│ 0 │ foo     │      │ alias │
╰───┴─────────┴──────┴───────╯
> def bar [] {}
> which bar
╭───┬─────────┬──────┬────────╮
│ # │ command │ path │  type  │
├───┼─────────┼──────┼────────┤
│ 0 │ bar     │      │ custom │
╰───┴─────────┴──────┴────────╯
> which git
╭───┬─────────┬──────────────┬──────────╮
│ # │ command │     path     │   type   │
├───┼─────────┼──────────────┼──────────┤
│ 0 │ git     │ /usr/bin/git │ external │
╰───┴─────────┴──────────────┴──────────╯
> 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

@amtoine amtoine added notes:breaking-changes Noted in Breaking Changes section notes:mention Noted in "Hall of Fame" section labels Jul 10, 2023
amtoine added 2 commits July 10, 2023 19:43
this commit also removes useless `cwd` and `r#...#` from some of
the `nu!` calls.
actually, aliases are seen as `built-in` now 🤔
@amtoine
amtoine marked this pull request as ready for review July 11, 2023 17:02
@amtoine

This comment was marked as outdated.

@fdncred

fdncred commented Jul 21, 2023

Copy link
Copy Markdown
Contributor

Let's move forward with this. Thanks!

@fdncred
fdncred merged commit a1f989c into nushell:main Jul 21, 2023
@amtoine
amtoine deleted the change-which-table-output branch July 21, 2023 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:breaking-changes Noted in Breaking Changes section notes:mention Noted in "Hall of Fame" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants