diff options
Diffstat (limited to '')
-rw-r--r-- | crates/yt/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/yt/src/videos/mod.rs | 21 |
2 files changed, 4 insertions, 18 deletions
diff --git a/crates/yt/Cargo.toml b/crates/yt/Cargo.toml index 6803e68..100eb29 100644 --- a/crates/yt/Cargo.toml +++ b/crates/yt/Cargo.toml @@ -30,7 +30,6 @@ chrono = { version = "0.4.41", features = ["now"] } chrono-humanize = "0.2.3" clap = { version = "4.5.40", features = ["derive"] } futures = "0.3.31" -nucleo-matcher = "0.3.1" owo-colors = "4.2.1" regex = "1.11.1" sqlx = { version = "0.8.6", features = ["runtime-tokio", "sqlite"] } diff --git a/crates/yt/src/videos/mod.rs b/crates/yt/src/videos/mod.rs index e821772..960340b 100644 --- a/crates/yt/src/videos/mod.rs +++ b/crates/yt/src/videos/mod.rs @@ -11,10 +11,6 @@ use anyhow::Result; use futures::{TryStreamExt, stream::FuturesUnordered}; -use nucleo_matcher::{ - Matcher, - pattern::{CaseMatching, Normalization, Pattern}, -}; pub mod display; @@ -46,19 +42,10 @@ pub async fn query(app: &App, limit: Option<usize>, search_query: Option<String> .await?; if let Some(query) = search_query { - let mut matcher = Matcher::new(nucleo_matcher::Config::DEFAULT.match_paths()); - - let pattern_matches = Pattern::parse( - &query.replace(' ', "\\ "), - CaseMatching::Ignore, - Normalization::Smart, - ) - .match_list(all_video_strings, &mut matcher); - - pattern_matches - .iter() - .rev() - .for_each(|(val, key)| println!("{val} ({key})")); + all_video_strings + .into_iter() + .filter(|video| video.to_lowercase().contains(&query.to_lowercase())) + .for_each(|video| println!("{video}")); } else { println!("{}", all_video_strings.join("\n")); } |