feat: make help items filtering case-insensitive, close #275

This commit is contained in:
sxyazi 2023-10-21 11:22:25 +08:00
parent 89e56cd0b2
commit e6fb999d1b
No known key found for this signature in database

View file

@ -33,8 +33,9 @@ impl Control {
#[inline]
pub fn contains(&self, s: &str) -> bool {
self.desc.as_ref().map(|d| d.contains(s)) == Some(true)
|| self.exec().contains(s)
|| self.on().contains(s)
let s = s.to_lowercase();
self.desc.as_ref().map(|d| d.to_lowercase().contains(&s)) == Some(true)
|| self.exec().to_lowercase().contains(&s)
|| self.on().to_lowercase().contains(&s)
}
}