diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-16 01:13:09 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-16 01:13:09 +0800 |
| commit | 3acf9cbdf292bf7724a9d208b887dc8dabf3e689 (patch) | |
| tree | e9c41e63ef369ed7c522cfedebca4e4fcd0a88e8 | |
| parent | 9231c1de40f6f66d59ab86bea113ac3ac323c62d (diff) | |
feat(picker): return NotFound for unmatched boolean flags
| -rw-r--r-- | mingling_picker/src/builtin/pick_bool.rs | 8 | ||||
| -rw-r--r-- | mingling_picker/src/parselib.rs | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/mingling_picker/src/builtin/pick_bool.rs b/mingling_picker/src/builtin/pick_bool.rs index ad93a83..65efe47 100644 --- a/mingling_picker/src/builtin/pick_bool.rs +++ b/mingling_picker/src/builtin/pick_bool.rs @@ -10,6 +10,12 @@ impl<'a> Pickable<'a> for bool { } fn pick(raw_strs: &[&str]) -> PickerArgResult<Self> { - PickerArgResult::Parsed(!raw_strs.is_empty()) + if raw_strs.is_empty() { + // No matching flag found — signal NotFound so the fallback chain + // (default → route) gets a chance to run. + PickerArgResult::NotFound + } else { + PickerArgResult::Parsed(true) + } } } diff --git a/mingling_picker/src/parselib.rs b/mingling_picker/src/parselib.rs index 74c53d0..5950c9d 100644 --- a/mingling_picker/src/parselib.rs +++ b/mingling_picker/src/parselib.rs @@ -116,7 +116,9 @@ fn build_masked_args<'a>(args: &'a PickerArgs, mask: &'a [u8]) -> Vec<MaskedArg< .filter_map(|r| { let idx = cidx; cidx += 1; - if is_masked(mask, cidx) { + // Include args where mask is 0 (available/not yet claimed). + // mask[i] = 0 means available; mask[i] != 0 means already claimed. + if !is_masked(mask, idx) { Some(MaskedArg { raw: r, raw_idx: idx, |
