From 3e2a4e886fd3425851e3d93dd7097c1eb6548489 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 29 Sep 2021 12:46:08 +0200 Subject: [PATCH] do not ignore boolean "noX" options --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index fadb2b9..d677791 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,7 +89,12 @@ macro_rules! parse_and_apply_options { for opt in $in_opts.iter() { let mut found = false; for opt_def in opt_def.iter() { - if opt.name == opt_def.name { + let mut matches = opt.name == opt_def.name; + if !matches && opt.name.starts_with("no") { + let (_, name) = opt.name.split_at(2); + matches = name == opt_def.name; + } + if matches { let arg = if let Some(ref str) = opt.value { Some(str) } else { None }; let ret = opt_def.parse(&opt.name, arg); if let Ok((val, _)) = ret { -- 2.30.2