https://github.com/loipesmas/cargo-select
Cargo subcommand to easily run targets/examples
https://github.com/loipesmas/cargo-select
cargo cargo-plugin cargo-subcommand developer-tools fuzzy fuzzy-matching fuzzy-search fzf rust rust-lang tui tui-rs
Last synced: about 1 year ago
JSON representation
Cargo subcommand to easily run targets/examples
- Host: GitHub
- URL: https://github.com/loipesmas/cargo-select
- Owner: LoipesMas
- License: gpl-2.0
- Created: 2022-06-18T11:45:22.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-24T18:51:17.000Z (almost 4 years ago)
- Last Synced: 2025-03-18T07:12:02.736Z (about 1 year ago)
- Topics: cargo, cargo-plugin, cargo-subcommand, developer-tools, fuzzy, fuzzy-matching, fuzzy-search, fzf, rust, rust-lang, tui, tui-rs
- Language: Rust
- Homepage:
- Size: 85.9 KB
- Stars: 19
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# cargo-select
### Cargo subcommand to easily run targets/examples/tests
Fuzzy match against targets, examples or tests in current rust project.
[](https://asciinema.org/a/QSaxIcXfjjjjyM4JGJwBZtZVS)
```
cargo-select 0.2.0
LoipesMas
Fuzzy-match targets/examples
USAGE:
cargo select [OPTIONS] [ARGS]
ARGS:
Cargo command to run with selected target (e.g. "run").
Pattern to fuzzy-match targets with. Omit for interactive mode.
... Additional arguments to pass to cargo.
OPTIONS:
-h, --help Print help information
--no-skip Run all tests that match selected test (i.e. dont skip names that are
supersets)(tests only)
-V, --version Print version information
```
`cargo select run` is special-cased to `cargo run` with `--package NAME` or `--example NAME`.
`cargo select test` is special-cased to match against test names (deduced from source files) and run them with `cargo test`.
Alternatives:
- You *could* just do `cargo test NAME`, but it doesn't let you find tests by name and doesnt work well with workspaces
- You *could* do a command similar to `cargo test -- --list | fzf | sed "s/: .*//" | xargs cargo test -- --exact`, but it requires compiling the tests which can take a lot of time and disk space on some projects (especially ones with a few workspaces). And it still has some limitations.
## Installation
### From crates.io
`cargo install cargo-select`
### From source
```
git clone https://github.com/LoipesMas/cargo-select.git
cd cargo-select
cargo install --path .
```