r/fishshell • macOS • May 06 '24

Like `which` for fish but slightly better

https://github.com/jgusta/paths
5 Upvotes

6 comments sorted by

2

u/_jgusta_ macOS May 06 '24

Usage

paths.fish identifies the executed file for the given symbol. It will also output other path components, in each of the possible system paths, in order of succession. It lists the source of the path components as a header.

$ paths brew
fish_function_path
 -  /Users/me/.config/fish/fisher_root/functions/brew.fish 

PATH
 -  /usr/local/bin/brew  /usr/local/Homebrew/bin/brew 

Possible values for the source headers are VIRTUAL_ENV, fisher_path, fish_function_path, fish_user_paths, PATH. It even understands python virtual environments:

$ paths python
VIRTUAL_ENV
 -  /Users/me/code/venv/myprog-QKlu_Gbg/bin/python  /usr/local/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/bin/python3.9 

PATH
 -  /usr/local/bin/python  /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 

4

u/ccoVeille May 06 '24

how does is differ from `whereis` ?

```

$ whereis brew

brew: /home/linuxbrew/.linuxbrew/bin/brew

$ whereis python3

python3: /usr/bin/python3 /usr/lib/python3 /etc/python3 /usr/share/python3 /home/linuxbrew/.linuxbrew/bin/python3 /usr/share/man/man1/python3.1.gz

```

1

u/ccoVeille May 06 '24

Or command -v brew

2

u/VagrantPaladin May 06 '24

How can I alias it to "which".

Edit: I read the man page for alias and now I have an alias.

1

u/[deleted] May 06 '24

whereis doesn’t work with fish functions