diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-28 15:58:03 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-28 15:58:03 +0800 |
| commit | dbc811d84fd809ea606a8bbed84b3e78e8cda334 (patch) | |
| tree | 319dc4a00d0933ca19e4a94ce78a138c3bbb72f6 | |
| parent | 4e293ccccc91f89fca5857a87c03afd83e7824f3 (diff) | |
Fix bool parsing ignoring explicit `--value true` flag
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | mingling/src/parser/picker/bools.rs | 17 |
2 files changed, 7 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b1bd92c..808b808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ #### Fixes: 1. Fixed a build failure on **Windows** caused by `mingling_core/src/program.rs` +2. **\[picker\]** Fixed an issue where the `Pickable` trait for `Yes` and `True` types could not correctly parse explicit boolean `--value true` #### Features: diff --git a/mingling/src/parser/picker/bools.rs b/mingling/src/parser/picker/bools.rs index 4015cd9..80e6d5b 100644 --- a/mingling/src/parser/picker/bools.rs +++ b/mingling/src/parser/picker/bools.rs @@ -113,17 +113,12 @@ fn pick_bool( flag: mingling_core::Flag, positive: &[&str], ) -> bool { - let has_flag = args.pick_flag(flag.clone()); - if !has_flag { - let content = args.pick_argument(flag); - match content { - Some(content) => { - let s = content.as_str(); - positive.contains(&s) - } - None => false, + let content = args.pick_argument(flag); + match content { + Some(content) => { + let s = content.as_str(); + positive.contains(&s) } - } else { - true + None => false, } } |
