Skip to content

Commit 44ba4d4

Browse files
feat: add --no-default-features flag (#647)
* feat: add --no-default-features flag * fix: update changelog * Update CHANGELOG.md Co-authored-by: Sergio Gasquez Arcos <[email protected]> --------- Co-authored-by: Sergio Gasquez Arcos <[email protected]>
1 parent 5c898ac commit 44ba4d4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
1011
- Add `hold-in-reset` and `reset` subcommands
12+
- [cargo-espflash]: Add `--no-default-features` flag to mirror cargo features behavior
1113

1214
## [3.1.0] - 2024-05-24
1315

cargo-espflash/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ struct BuildArgs {
128128
/// Comma delimited list of build features
129129
#[arg(long, use_value_delimiter = true)]
130130
pub features: Option<Vec<String>>,
131+
/// Do not activate the `default` feature
132+
#[arg(long)]
133+
pub no_default_features: bool,
131134
/// Require Cargo.lock and cache are up to date
132135
#[arg(long)]
133136
pub frozen: bool,
@@ -373,6 +376,9 @@ fn build(
373376
.ok_or_else(|| NoTargetError::new(Some(chip)))?;
374377

375378
let mut metadata_cmd = MetadataCommand::new();
379+
if build_options.no_default_features {
380+
metadata_cmd.features(cargo_metadata::CargoOpt::NoDefaultFeatures);
381+
}
376382
if let Some(features) = &build_options.features {
377383
metadata_cmd.features(cargo_metadata::CargoOpt::SomeFeatures(features.clone()));
378384
}
@@ -435,6 +441,10 @@ fn build(
435441
args.push(package.to_string());
436442
}
437443

444+
if build_options.no_default_features {
445+
args.push("--no-default-features".to_string());
446+
}
447+
438448
if let Some(features) = &build_options.features {
439449
args.push("--features".to_string());
440450
args.push(features.join(","));

0 commit comments

Comments
 (0)