Skip to content

Commit

Permalink
Support passing --config option directly to cargo
Browse files Browse the repository at this point in the history
  • Loading branch information
pacak committed Sep 19, 2024
1 parent e96b44f commit 456fff5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [0.2.39] - 2024-09-19
- support --config KEY=VAL option that is passed directly to cargo
- bump deps

## [0.2.38] - 2024-07-02
- slightly smarter artifact detection, shouldn't panic with wasm crates
- bump deps
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Show the code rustc generates for any function
**Cargo options**
- **` --manifest-path`**=_`PATH`_ —
Path to Cargo.toml, defaults to one in current folder
- **` --config`**=_`<KEY=VALUE>`_ &mdash;
Override a cargo configuration value
- **` --target-dir`**=_`DIR`_ &mdash;
Use custom target directory for generated artifacts, create if missing

Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ fn spawn_cargo(
.args(["--package", &focus_package.name])
.args(focus_artifact.as_cargo_args())
// Compile options.
.args(cargo.config.iter().flat_map(|c| ["--config", c]))
.args(cargo.dry.then_some("--dry"))
.args(cargo.frozen.then_some("--frozen"))
.args(cargo.locked.then_some("--locked"))
Expand Down
4 changes: 4 additions & 0 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ pub struct Cargo {
#[bpaf(external, hide_usage)]
pub manifest_path: PathBuf,

/// Override a cargo configuration value
#[bpaf(argument("KEY=VALUE"))]
pub config: Vec<String>,

/// Use custom target directory for generated artifacts, create if missing
#[bpaf(
env("CARGO_TARGET_DIR"),
Expand Down

0 comments on commit 456fff5

Please sign in to comment.