Output alias' definition in `which`
Basics
- [x] I have done a basic search through the issue tracker to find similar or related issues. (Note: hard to filter down issue list due to keywords "which" and "alias" matching large number of unrelated issues).
- [x] I have made myself familiar with the available features of Nushell for the particular area this enhancement request touches.
Related problem
The which command prints three columns: command, path and type.
When type is external then path column contains the absolute path to the executable.
This breaks an existing experience for me, where in zsh (using ohmyzsh), the which command prints "$(alias): aliased to $(definition)".
Describe the solution you'd like
I'd like for which to report the definition of aliases. Most straightforward would be an additional column that is blank for non-alias entries and contains a string with the aliases definition.
Describe alternatives you've considered
The functionality currently exists as alias and alias {name} to print all and specific alias definitions respectively, however those are not structured outputs. Also it removes some convience from which in that it no longer thoroughly reveals what a certain command is.
Alternatively path could be used because it has no function for these entries otherwise, but that creates minor breakage for existing scripts that filter using which without filtering on type and instead filter to non-empty path.
Additional context and details
No response
We'd probably accept a PR for this change. Shouldn't be too difficult.
Hi, @fdncred could I be assigned this issue if that's okay? I'll follow the contribution guidelines and reach out in this thread if I have questions.
done. have fun!
Thanks, I've created the PR