Run multiple Cargo commands sequentially or in parallel.
cargo install cargo-q --locked- Run multiple Cargo commands sequentially, separated by spaces
- Stop at the first failure and exit with that command's code
- Parallel execution (experimental)
- Verbose mode
cargo q checkcargo q check test # Runs check, then testTokens starting with - are arguments to the preceding command:
cargo q build -r test --no-runQuote a command whose argument does not start with -:
cargo q "test --features feature1"Any other bare token must name a cargo subcommand; cargo-q errors instead of guessing:
cargo q build --features feature1
# error: 'feature1' is not a cargo subcommand
# help: quote the whole command: cargo q "build --features feature1"
# help: or attach the value: cargo q build --features=feature1The hints echo the command you typed, so the fix can be pasted back:
cargo q run -p oven
# error: 'oven' is not a cargo subcommand
# help: quote the whole command: cargo q "run -p oven"
# help: or attach the value: cargo q run -p=ovenA bare token that is a subcommand still starts a new command, even when you
meant it as an argument. Feature names like test and aliases like t
collide this way:
cargo q build --features test # runs `cargo build --features` and `cargo test`
cargo q "build --features test" # passes test as the feature
cargo q build --features=test # same-n/--dry-run shows how a command line was split, without running anything:
cargo q -n build --features test
# 2 command(s), sequentially:
# cargo build --features
# cargo testcargo-q stops at the first failure, like && in a shell, and exits with that
command's own code:
cargo q clippy test # clippy fails -> test is skipped-k/--keep-going runs the whole list anyway; the exit code still reports the
first failure:
cargo q -k fmt clippy testIn parallel mode only queued commands are skipped — one already running is left to finish.
Warning
Parallel execution may not be any faster. Commands like cargo check, cargo build, and cargo test share the same target directory and lock it, so they block each other instead of overlapping.
cargo q -p check test # Run both commands in parallel
cargo q --parallel check test # Same as abovecargo q -v check test # Show each command's output as it runs
cargo q --verbose check test # Same as above--verbose is sequential only. With --parallel, cargo-q warns and runs quietly.
| Code | Meaning |
|---|---|
0 |
all commands succeeded |
| child's code | the first command that failed (e.g. 101 from cargo test) |
128 + signal |
that command was killed by a signal |
130 |
interrupted with Ctrl-C |
Licensed under Apache-2.0 license (LICENSE or http://opensource.org/licenses/Apache-2.0)