cargo-hack icon indicating copy to clipboard operation
cargo-hack copied to clipboard

add ability to pass through flags to underlying cargo subcommand

Open cyphar opened this issue 3 months ago • 0 comments

While some commands make sense for cargo-hack to parse itself (--features being the obvious one), I have run into issues where cargo-hack happens to use the same flag name as a sub-command I am trying to run.

For a specific example, I was trying to use nextest's --partition flag to partition the actual tests being run, but because cargo-hack has its own --partition flag I cannot use it:

% cargo hack --feature-powerset --features=capi nextest run --partition=hash:1/10
error: bad or out-of-range partition: hash:1/10

I would expect -- to be the standard solution to fix this, but no matter where you put it you get an error AFAICS. (In my case I'm actually using cargo-llvm-cov as well so the flag parsing gets even more complicated.)

Is there a correct way of solving this problem today, and if not can there either be better support for -- or a new --args flag that lets you specify flags to pass down unparsed to the underlying subcommand?

cyphar avatar Sep 26 '25 07:09 cyphar