Skip to content

Commit

Permalink
Make the 'ble' and 'wifi' features mutually exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham committed Oct 25, 2024
1 parent 5f285d1 commit dabdc2c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,17 +391,24 @@ fn process_options(args: &Args) {
for option in &args.option {
// Find the matching option in OPTIONS
if let Some(option_item) = OPTIONS.iter().find(|item| item.name() == *option) {
// Check if the chip is supported. If the chip list is empty, all chips are supported
// Check if the chip is supported. If the chip list is empty,
// all chips are supported:
if !option_item.chips().iter().any(|chip| chip == &args.chip)
&& !option_item.chips().is_empty()
{
eprintln!(
"Error: Option {:?} is not supported for chip {:?}",
"Error: Option '{}' is not supported for chip {}",
option, args.chip
);
process::exit(-1);
}
}
}

if args.option.contains(&String::from("ble")) && args.option.contains(&String::from("wifi")) {
eprintln!("Error: Options 'ble' and 'wifi' are mutually exclusive");
process::exit(-1);
}
}

#[cfg(test)]
Expand Down

0 comments on commit dabdc2c

Please sign in to comment.