harryfei / which-rs

A Rust equivalent of Unix command "which".

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Searching for executables with regular expressions

marier-nico opened this issue · comments

Hi, thanks for the nice crate!

I had a feature request that I think could be really nice and add a lot of use-cases to the crate.

The idea is to add the possibility to use regular expressions to find all the paths to all executables matching a certain pattern. This can be useful when you can have multiple versions of the same program installed and want to find all available versions. For example, with python, you have python3.5, python3.7, python3.10, etc.

It would be really nice to be able to use something like which::which_all_re(r"python3.\d+") to find all the available versions. This could maybe be an optional feature by using Cargo's features.

I'm curious to know what you think 😄

commented

It ok to me. But I have not much time to implement it immediately. PR is welcome 😄

Sounds good, I'll try to come up with something this weekend if I have time! 🚀