From dabdc2c35bc789c9073a1cdbc860a87872c1c925 Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Fri, 25 Oct 2024 13:28:59 +0200 Subject: [PATCH] Make the 'ble' and 'wifi' features mutually exclusive --- src/main.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 7777806..9f3cdee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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)]