# cargo-rx
[](https://github.com/rnag/cargo-rx)
[](https://crates.io/crates/cargo-rx)
[](https://docs.rs/cargo-rx)
[](https://github.com/rnag/cargo-rx/actions/workflows/build.yml?query=branch%3Amain)
**`cargo-rx` is a simple fuzzy finder and *R*unner for *Ex*amples in a [Cargo] project.**
[Cargo]: http://doc.crates.io/
This crate provides a single executable: `rx`.
Basically anywhere you would use `cargo run --example` in a
Rust project, try `rx` instead.
**If this project has helped you, please consider making a [donation](https://www.buymeacoffee.com/ritviknag).**
## Table of Contents
* [Installation](#installation)
* [From source](#from-source)
* [From binaries](#from-binaries)
* [Windows](#windows)
* [Features](#features)
* [Contributing](#contributing)
* [Buy me a coffee](#buy-me-a-coffee)
* [License](#license)
* [Authors](#authors)
## Installation
### From source
Ensure that you have a fairly recent version of [rust/cargo] installed. Then, run:
```shell
$ cargo install cargo-rx
```
*Compiler support: requires rustc 1.58+*
[rust/cargo]: https://doc.rust-lang.org/cargo/getting-started/installation.html
### From binaries
Check out the [Releases page] for pre-built binaries compatible
with various architectures.
[Releases page]: https://github.com/rnag/cargo-rx/releases
### Windows
Note that on a *Windows* environment, you will also need to have [fzf installed]
and available in your *$PATH* variable.
An easy way to install fzf is via [Chocolatey]:
```console
choco install fzf
```
There is currently a [feature request] open on `skim` which proposes adding
support for Windows, but this has not been currently implemented yet --
thus, the `fzf` tool serves as a stand-in alternative for now.
[fzf installed]: https://github.com/junegunn/fzf#windows
[Chocolatey]: https://chocolatey.org/packages/fzf
[feature request]: https://github.com/lotabout/skim/issues/293
## Features
* Fuzzy finder, which leverages [skim] to sort and search for *examples* in a Cargo project -- when called with just `rx`.
* Pass arguments after `--` to the selected example.
* Automatically [enables required-features] when running an example.
* Support for nested [crates with binary targets].
* Play back of most recently run example via the `--replay` option.
* Automatically enables `+nightly` toolchain when passed in *unstable options* to `cargo run`, such as `--unit-graph`.
[skim]: https://github.com/lotabout/skim
[enables required-features]: https://github.com/rust-lang/cargo/issues/4663
[crates with binary targets]: https://github.com/rnag/cargo-rx/issues/19
## Contributing
Contributions are welcome! Open a pull request to fix a bug, or [open an issue][]
to discuss a new feature or change.
Check out the [Contributing][] section in the docs for more info.
[Contributing]: CONTRIBUTING.md
[open an issue]: https://github.com/rnag/cargo-rx/issues
## Buy me a coffee
Liked some of my work? Buy me a coffee (or more likely a beer)
## License
This project is proudly licensed under the MIT license ([LICENSE](LICENSE)
or http://opensource.org/licenses/MIT).
`cargo-rx` can be distributed according to the MIT license. Contributions
will be accepted under the same license.
## Authors
* `cargo-rx` is brought to you by [Ritvik Nag](https://github.com/rnag).