| Crates.io | superwhich |
| lib.rs | superwhich |
| version | 2.0.1 |
| created_at | 2024-11-04 17:04:25.143596+00 |
| updated_at | 2025-04-15 04:41:04.446709+00 |
| description | Cross-platform smart which alternative |
| homepage | https://docs.rs/crate/superwhich/latest |
| repository | https://github.com/DarkCeptor44/superwhich |
| max_upload_size | |
| id | 1435323 |
| size | 88,664 |
superwhich is a cross-platform CLI tool and library that was initially meant to be a faster drop-in replacement for Windows' where command but since it uses Jaro-Winkler distance to calculate the similarity between the strings it can be called a sort of "smart" which, it can handle some typos and highlights the section of the executables that matches the search pattern.
cargo install superwhichcargo install --git https://github.com/DarkCeptor44/superwhichcargo install --path .cargo add superwhich
Or you can add this to your Cargo.toml file:
[dependencies]
superwhich = "^2"

$ swhich -h
Cross-platform smart which alternative
Usage: swhich.exe [OPTIONS] <PATTERN>
Arguments:
<PATTERN> The search pattern
Options:
-c, --color <COLOR> Color of the highlighted text (off or set `NO_COLOR` env var to disable) [default: blue]
-T, --threshold <THRESHOLD> String similarity threshold (0.0 to 1.0) [default: 0.7]
-t, --print-time Print time elapsed
-h, --help Print help
-V, --version Print version
~221ms on Windows).You can run the tests with cargo test.
The library benchmarks can be ran with cargo bench.
| Benchmark | Min Mean Max | Outliers |
|---|---|---|
find_executables/fake binaries |
73.288 µs 73.486 µs 73.725 µs | 4 (4.00%) high mild, 6 (6.00%) high severe |
find_executables/real PATH |
210.48 ms 211.14 ms 211.84 ms | 4 (4.00%) high mild, 1 (1.00%) high severe |
highlight_text |
1.4787 µs 1.4829 µs 1.4872 µs | 2 (2.00%) low mild, 1 (1.00%) high mild, 3 (3.00%) high severe |
The CLI was benchmarked using Hyperfine.
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
where pnpm |
94.7 ± 1.1 | 93.5 | 98.7 | 1.00 |
swhich pnpm |
221.8 ± 3.5 | 215.7 | 229.2 | 2.34 ± 0.05 |
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
which lookfor |
3.0 ± 0.2 | 2.6 | 4.7 | 1.00 |
swhich lookfor |
17.6 ± 0.3 | 17.0 | 19.8 | 5.93 ± 0.43 |
This project is licensed under the terms of the GNU General Public License v3.0.