Skip to content

Commit

Permalink
feat: support hyphen values for --build-jobs (#1874)
Browse files Browse the repository at this point in the history
cargo --jobs supports negative values:
rust-lang/cargo#9217

currently this fails:

```
cargo nextest run --build-jobs -1                                                                                                                                                                                                   
error: unexpected argument '-1' found

  tip: to pass '-1' as a value, use '-- -1'
```

because clap doesn't support this by default and requires
`allow_hyphen_values = true`

clap-rs/clap#1245
  • Loading branch information
mattsse authored Nov 15, 2024
1 parent 8668970 commit 8530c1a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cargo-nextest/src/cargo_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ pub(crate) struct CargoOptions {
long,
value_name = "N",
group = "cargo-opts",
help_heading = "Compilation options"
help_heading = "Compilation options",
allow_hyphen_values = true
)]
build_jobs: Option<String>,

Expand Down
3 changes: 3 additions & 0 deletions cargo-nextest/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2406,6 +2406,9 @@ mod tests {
// Test negative test threads
"cargo nextest run --jobs -3",
"cargo nextest run --jobs 3",
// Test negative cargo build jobs
"cargo nextest run --build-jobs -1",
"cargo nextest run --build-jobs 1",
];

let invalid: &[(&'static str, ErrorKind)] = &[
Expand Down

0 comments on commit 8530c1a

Please sign in to comment.