#cargo-subcommand #cargo #tui #subcommand #plugin

app cargo-selector

Cargo subcommand to select and execute binary/example targets

7 releases (breaking)

new 0.6.0 Dec 13, 2024
0.5.0 Dec 12, 2024
0.4.1 Aug 8, 2024
0.4.0 Apr 25, 2024
0.1.0 Apr 11, 2024

#215 in Cargo plugins

Download history 3/week @ 2024-08-31 1/week @ 2024-09-07 13/week @ 2024-09-21 7/week @ 2024-09-28 1/week @ 2024-10-05 12/week @ 2024-10-12 3/week @ 2024-10-19 6/week @ 2024-11-02 3/week @ 2024-11-16 4/week @ 2024-11-23 11/week @ 2024-11-30 123/week @ 2024-12-07

141 downloads per month

MIT license

20KB
498 lines

cargo-selector

Crate Status

Cargo subcommand to select and execute binary/example targets

(This demo uses Ratatui as an example!)

Installation

$ cargo install cargo-selector

AUR

$ paru -S cargo-selector

Usage

Usage: cargo selector [OPTIONS]

Options:
  -i, --inline                   Display list inline
  -n, --inline-list-size <SIZE>  List size [default: 10]
  -k, --kind <NAME>              Target kind [possible values: bin, example]
  -t, --match-type <TYPE>        Match type [default: substring] [possible values: substring, fuzzy]
  -h, --help                     Print help
  -V, --version                  Print version

Run the command in the cargo project directory:

$ cargo selector

Then, target list will be displayed, and you can execute the following command by selecting it.

# if the target is bin
$ cargo run --bin xyz [--features "foo bar"]

# if the target is example
$ cargo run --example xyz [--features "foo bar"]

By switching the action, you can also run only the build.

Keybindings

Key Description
Down Ctrl+n cursor down
Up Ctrl+p cursor up
Enter execute cargo run --bin/example <selected>
Tab switch actions
Esc Ctrl+c quit

License

MIT

Dependencies

~8–18MB
~256K SLoC