Crates.io | cargo-selector |
lib.rs | cargo-selector |
version | |
source | src |
created_at | 2024-04-11 08:46:07.616019+00 |
updated_at | 2025-02-22 01:22:47.60526+00 |
description | Cargo subcommand to select and execute binary/example targets |
homepage | https://github.com/lusingander/cargo-selector |
repository | https://github.com/lusingander/cargo-selector |
max_upload_size | |
id | 1204600 |
Cargo.toml error: | TOML parse error at line 24, column 1 | 24 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Cargo subcommand to select and execute binary/example targets
(This demo uses Ratatui as an example!)
$ cargo install cargo-selector
$ paru -S cargo-selector
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 [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.
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 |
If the CARGO_SELECTOR_CONFIG
environment variable specifies the path to the config file, the config will be loaded.
The config file uses the following format:
# Sets the default match type. If argument `-t` or `--match-type` is specified, it will be overridden.
# type: enum ("substring" | "fuzzy")
match_type = "substring"
# Sets the display colors.
# Colors can be set in one of the following formats:
# - ANSI color name
# - "red", "bright-blue"
# - 8-bit color (256-color) index values
# - "34", "128", "255"
# - 24-bit true color hex codes
# - "#abcdef"
# type: string
[color]
bg = "reset"
action_run_bg = "green"
action_run_fg = "black"
action_build_bg = "blue"
action_build_fg = "black"
input_fg = "reset"
numbers_fg = "darkgrey"
kind_fg = "blue"
name_fg = "white"
name_match_fg = "red"
path_fg = "darkgrey"
features_fg = "darkgrey"
selected_bg = "yellow"
MIT