I'm excited to share my first complete Rust project with you all and would greatly appreciate your feedback and suggestions. As a newcomer to Rust, this project has been an incredible learning experience and elevated my understanding of the language significantly, although it's probably only like 10% of what is there to know .
The project is a simple CLI tool that allows you to quickly switch or "leap" to a folder or file, more details in crates.io: Rust Package Registry.
Those kind of cli tools generally have a two steps approach. Your binary should prints the desired path or exit with a an error and the user should add a shell alias or function calling your binary and using its output to actually change directory.
You're currently spawning a new (bash) shell everytime.
The project was mostly to learn Rust, when I run into the technical limitation I opted for the easiest option. I did not review other similar tools or how to avoid the shell spawning.
You are obviously right to point this out, I should have mentioned this and will add it to the readme, and thank you for your feedback and the example, very helpful!
Code itself is fine, I would encourage you to use the type system more, eg: using clap's derive API, not returning an empty pathbuf but an option instead. Algorithm note: search a stream of paths instead of collecting the paths then search among them. Also lots of your functions are pretty tangled with each other, I'd advise to make them take inputs and return outputs instead of mutating internal state.