Browse Source

ui: add "is:" alias for "flags:" query

tags/pre-alpha-0.4.0
Manos Pitsidianakis 3 months ago
parent
commit
35e34d1c09
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS. GPG Key ID: 73627C2F690DF710
1 changed files with 26 additions and 23 deletions
  1. +26
    -23
      ui/src/cache.rs

+ 26
- 23
ui/src/cache.rs View File

@@ -144,30 +144,33 @@ pub mod query_parser {

fn flags<'a>() -> impl Parser<'a, Query> {
move |input| {
whitespace_wrap(match_literal_anycase("flags:"))
.parse(input)
.and_then(|(rest, _)| {
map(one_or_more(pred(any_char, |c| *c != ' ')), |chars| {
chars.into_iter().collect::<String>()
})
.parse(rest)
})
.and_then(|(rest, flags_list)| {
if let Ok(r) = flags_list
.split(",")
.map(|t| {
either(quoted_string(), string())
.parse_complete(t)
.map(|(_, r)| r)
})
.collect::<std::result::Result<Vec<String>, &str>>()
.map(|v| Flags(v))
{
Ok((rest, r))
} else {
Err(rest)
}
whitespace_wrap(either(
match_literal_anycase("flags:"),
match_literal_anycase("is:"),
))
.parse(input)
.and_then(|(rest, _)| {
map(one_or_more(pred(any_char, |c| *c != ' ')), |chars| {
chars.into_iter().collect::<String>()
})
.parse(rest)
})
.and_then(|(rest, flags_list)| {
if let Ok(r) = flags_list
.split(",")
.map(|t| {
either(quoted_string(), string())
.parse_complete(t)
.map(|(_, r)| r)
})
.collect::<std::result::Result<Vec<String>, &str>>()
.map(|v| Flags(v))
{
Ok((rest, r))
} else {
Err(rest)
}
})
}
}



Loading…
Cancel
Save