# whence
A command-line tool for locating executables in your PATH, written in Rust.
## Why?
Traditional `which` implementations work fine. This one has colors and uses threads.
## Features
- **Concurrent PATH scanning** - Parallel directory traversal (because why not)
- **Colorized output** - Visual distinction between executables and symlinks
- **Detailed file information** - Permissions, sizes, and modification times
- **Symlink resolution** - See where those links actually point
- **Duplicate detection** - Identify and filter duplicate PATH entries
- **Performance statistics** - Detailed timing and search metrics
- **JSON output** - Machine-readable output for automation
## Installation
```bash
cargo install --path .
```
Installs both `whence` and `wnc` binaries.
## Usage
Find a command:
```bash
whence cargo
```
Show all matches in PATH:
```bash
whence -a python3
```
Display detailed file information:
```bash
whence -l cargo
# rwxr-xr-x 7.2M Jan 15 22:35 /Users/you/.cargo/bin/cargo
```
Resolve symbolic links:
```bash
whence -L python3
# /opt/homebrew/bin/python3
# └→ /opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/bin/python3.13
```
Remove duplicate results:
```bash
whence -a -u python3
```
Show performance metrics:
```bash
whence --stats cargo
```
Output as JSON:
```bash
whence --json -l -L python3
```
## Performance
Roughly 3x slower than `which`. The extra features come at a cost.
```
Benchmark 1: whence cargo
Time (mean ± σ): 2.5 ms ± 3.1 ms
Benchmark 2: which cargo
Time (mean ± σ): 783.5 µs ± 3411.4 µs
```
For interactive use, the difference is imperceptible. For tight loops, use `which`.
## Development
```bash
cargo test # Run tests
cargo build --release # Build optimized binary
cargo clippy # Pedantic mode enabled
```
## License
MIT or Apache 2.0, your choice.