Skip to content

JamesPatrickGill/whence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

cargo install --path .

Installs both whence and wnc binaries.

Usage

Find a command:

whence cargo

Show all matches in PATH:

whence -a python3

Display detailed file information:

whence -l cargo
# rwxr-xr-x     7.2M Jan 15 22:35 /Users/you/.cargo/bin/cargo

Resolve symbolic links:

whence -L python3
# /opt/homebrew/bin/python3
#   └→ /opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/bin/python3.13

Remove duplicate results:

whence -a -u python3

Show performance metrics:

whence --stats cargo

Output as JSON:

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

cargo test              # Run tests
cargo build --release   # Build optimized binary
cargo clippy            # Pedantic mode enabled

License

MIT or Apache 2.0, your choice.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages