Skip to content

Commit

Permalink
feat: add --no-default-features flag
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennetremel committed Jun 13, 2024
1 parent 5c898ac commit e5593a1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cargo-espflash/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ struct BuildArgs {
/// Comma delimited list of build features
#[arg(long, use_value_delimiter = true)]
pub features: Option<Vec<String>>,
/// Do not activate the `default` feature
#[arg(long)]
pub no_default_features: bool,
/// Require Cargo.lock and cache are up to date
#[arg(long)]
pub frozen: bool,
Expand Down Expand Up @@ -373,6 +376,9 @@ fn build(
.ok_or_else(|| NoTargetError::new(Some(chip)))?;

let mut metadata_cmd = MetadataCommand::new();
if build_options.no_default_features {
metadata_cmd.features(cargo_metadata::CargoOpt::NoDefaultFeatures);
}
if let Some(features) = &build_options.features {
metadata_cmd.features(cargo_metadata::CargoOpt::SomeFeatures(features.clone()));
}
Expand Down Expand Up @@ -435,6 +441,10 @@ fn build(
args.push(package.to_string());
}

if build_options.no_default_features {
args.push("--no-default-features".to_string());
}

if let Some(features) = &build_options.features {
args.push("--features".to_string());
args.push(features.join(","));
Expand Down

0 comments on commit e5593a1

Please sign in to comment.