blob: e508c7e6d74239d7940bab2af8f68922bbef06b0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// Doc Not Optimize
use crate::parselib::{FlagMatcher, Matcher};
use crate::pickable_needed::*;
impl<'a> Pickable<'a> for bool {
fn get_attr(_: &'a PickerArg<'a, Self>) -> PickerArgAttr {
PickerArgAttr::Flag
}
fn tag(ctx: TagPhaseContext) -> Vec<usize> {
FlagMatcher::match_all(ctx.into())
}
fn pick(raw_strs: &[&str]) -> PickerArgResult<Self> {
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)
}
}
}
|