Cargo subcommand to easily run targets/examples

Overview

cargo-select

Cargo subcommand to easily run targets/examples/tests

Fuzzy match against targets, examples or tests in current rust project. asciicast

cargo-select 0.2.0
LoipesMas
Fuzzy-match targets/examples

USAGE:
    cargo select [OPTIONS] [ARGS]

ARGS:
    <CARGO_COMMAND>    Cargo command to run with selected target (e.g. "run").
    <PATTERN>          Pattern to fuzzy-match targets with. Omit for interactive mode.
    <CARGO_ARGS>...    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 .
You might also like...
A cargo plugin to shrink cargo's output

cargo single-line A simple cargo plugin that shrinks the visible cargo output to a single line (okay, in the best case scenario). In principle, the pl

Cargo-eval - A cargo plugin to quickly evaluate some Rust source code.

cargo eval A cargo plugin to quickly evaluate some Rust source code. Installation $ cargo install --git https://github.com/timClicks/cargo-eval.git Us

Cargo-about - 📜 Cargo plugin to generate list of all licenses for a crate 🦀

📜 cargo-about Cargo plugin for generating a license listing for all dependencies of a crate See the book 📕 for in-depth documentation. Please Note:

Code examples for https://www.poor.dev/blog/terminal-anatomy/

This repository contains examples from the Anatomy of a Terminal Emulator blog post. Each folder contains a separate example and can be run separately

Terminal UI that allows Alacritty users to quickly and easily shuffle through provided themes 🦄

Alac-pretty alac-pretty.mp4 If you're like me in that you constantly need to change the colors of your dev environment because visual stagnation reall

dye is a tool to easily color text in shell.
dye is a tool to easily color text in shell.

Dye dye is a tool to easily color text in shell. Usage See the gif below to see these commands in action. echo $(dye --red WARN) This tool will knock

fas stand for Find all stuff and it's a go app that simplify the find command and allow you to easily search everything you nedd
fas stand for Find all stuff and it's a go app that simplify the find command and allow you to easily search everything you nedd

fas fas stands for Find all stuff and it's a rust app that simplify the find command and allow you to easily search everything you need. Note: current

A command line utility to easily make dank memes
A command line utility to easily make dank memes

meme-cli A command line utility to easily make dank memes. Yes, really. Installation cargo install meme-cli Alternatively, install from source using g

zigfi is an open-source stocks, commodities and cryptocurrencies price monitoring CLI app, written fully in Rust, where you can organize assets you're watching easily into watchlists for easy access on your terminal.
zigfi is an open-source stocks, commodities and cryptocurrencies price monitoring CLI app, written fully in Rust, where you can organize assets you're watching easily into watchlists for easy access on your terminal.

zigfi zigfi is an open-source stocks, commodities and cryptocurrencies price monitoring CLI app, written fully in Rust, where you can organize assets

Comments
  • Add test selection

    Add test selection

    I wish we could fuzzy-select a test to run. I don't know if it's feasible, because the only way (or at least the only way that I know about) to get the list of tests is to run cargo test -- --list which compiles the whole project, which is not optimal. If you have any ideas or want to try to tackle this, feel free to tell me. (We could parse every .rs file looking for #[test]s, but I want to believe that there is a better way)

    enhancement help wanted 
    opened by LoipesMas 1
  • Fix `carg_args`

    Fix `carg_args`

    cargo_args argument is supposed to be working just like cargo does with arguments after --, but I haven't managed to achieve that with clap's derives. Maybe I missed something or maybe we need to use builder api instead.

    https://github.com/LoipesMas/cargo-select/blob/9e30e9bb36591fe960e784c8d241c8d4473c9aba/src/cli.rs#L80

    bug help wanted good first issue 
    opened by LoipesMas 0
Owner
null
Dead simple, memoized cargo subcommand to hoist cargo-built binaries into the current working directory, written in Rust.

cargo-hoist Dead simple cargo subcommand to hoist cargo-built binaries into scope. stable Install | User Docs | Crate Docs | Reference | Contributing

refcell.eth 6 Nov 9, 2023
A simple, modern fuzzy finder tool to run examples in a Cargo project.

cargo-rx cargo-rx is a simple, modern Runner for Examples in a Cargo project. This crate provides a single executable: rx. Basically anywhere you woul

Ritvik Nag 14 Dec 2, 2022
A very simple third-party cargo subcommand to execute a custom command

cargo-x A very simple third-party cargo subcommand to execute a custom command Usage install cargo-x cargo install cargo-x or upgrade cargo install -

刘冲 9 Dec 26, 2022
a cargo subcommand for counting lines of code in Rust projects

cargo-count Linux: A cargo subcommand for displaying line counts of source code in projects, including a niave unsafe counter for Rust source files. T

Kevin K. 125 Dec 1, 2022
Cargo script subcommand

cargo-script cargo-script is a Cargo subcommand designed to let people quickly and easily run Rust "scripts" which can make use of Cargo's package eco

Daniel Keep 643 Jan 3, 2023
A cargo subcommand for checking and applying updates to installed executables

cargo-update A cargo subcommand for checking and applying updates to installed executables Documentation Manpage Installation Firstly, ensure you have

наб 827 Jan 4, 2023
Cargo subcommand `release`: everything about releasing a rust crate.

cargo release Features Ensure you are in a good state for release, including: Right branch Up-to-date with remote Clean tree Supports workspaces using

null 933 Jan 8, 2023
A cargo subcommand that displays ghidra function output through the use of the rizin rz-ghidra project.

cargo-rz-ghidra A cargo subcommand that displays ghidra function output through the use of the rizin rz-ghidra project. Install cargo install --git ht

wcampbell 4 Nov 5, 2022
F-Fetch targets low systems. Written in Rust. It's very simple, designed so you can pick it up and replace it.

F-Fetch F-Fetch targets low systems. Written in Rust. It's very simple, designed so you can pick it up and replace it. First Look ~/.config/ffetch/con

cd 3 Jul 10, 2023
Helps cargo build and run apps for iOS

cargo-xcodebuild Helps cargo build and run apps for iOS. ?? ⚙️ ?? Setup You need to install Xcode (NOT just Command Line Tools!), xcodegen, cargo-xcod

Igor Shaposhnik 29 Nov 22, 2022