Compare commits

...

2 Commits

Author SHA1 Message Date
cuddle-please
849bc8a5f2 chore(release): 0.2.1
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-09-15 20:13:22 +00:00
c2dfd020bf chore: cleanup warnings
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-15 22:12:42 +02:00
5 changed files with 24 additions and 15 deletions

View File

@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [0.2.1] - 2024-09-15
### Added
- implement naive fuzzy matcher
### Other
- cleanup warnings
- move fuzzy search out of command
- refactor/matcher move to a separate file
- move fuzzy search out of command
- Actually add fuzzy matcher
- extract matcher
- update dependencies
- *(deps)* update rust crate anyhow to v1.0.89
## [0.2.0] - 2024-09-14 ## [0.2.0] - 2024-09-14
### Added ### Added

View File

@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2" resolver = "2"
[workspace.package] [workspace.package]
version = "0.2.0" version = "0.2.1"
[workspace.dependencies] [workspace.dependencies]
gitnow = { path = "crates/gitnow" } gitnow = { path = "crates/gitnow" }

View File

@ -1,5 +1,3 @@
use nucleo_matcher::{pattern::Pattern, Matcher, Utf32Str};
use crate::{ use crate::{
app::App, cache::CacheApp, fuzzy_matcher::FuzzyMatcherApp, projects_list::ProjectsListApp, app::App, cache::CacheApp, fuzzy_matcher::FuzzyMatcherApp, projects_list::ProjectsListApp,
}; };
@ -55,11 +53,11 @@ impl RootCommand {
} }
trait StringExt { trait StringExt {
fn as_str_vec<'a>(&'a self) -> Vec<&'a str>; fn as_str_vec(&self) -> Vec<&str>;
} }
impl StringExt for Vec<String> { impl StringExt for Vec<String> {
fn as_str_vec<'a>(&'a self) -> Vec<&'a str> { fn as_str_vec(&self) -> Vec<&str> {
self.iter().map(|r| r.as_ref()).collect() self.iter().map(|r| r.as_ref()).collect()
} }
} }

View File

@ -11,7 +11,7 @@ impl FuzzyMatcher {
pub fn match_pattern<'a>(&self, pattern: &'a str, items: &'a [&'a str]) -> Vec<&'a str> { pub fn match_pattern<'a>(&self, pattern: &'a str, items: &'a [&'a str]) -> Vec<&'a str> {
let pat = Pattern::new( let pat = Pattern::new(
&pattern, pattern,
nucleo_matcher::pattern::CaseMatching::Ignore, nucleo_matcher::pattern::CaseMatching::Ignore,
nucleo_matcher::pattern::Normalization::Smart, nucleo_matcher::pattern::Normalization::Smart,
nucleo_matcher::pattern::AtomKind::Fuzzy, nucleo_matcher::pattern::AtomKind::Fuzzy,
@ -19,7 +19,7 @@ impl FuzzyMatcher {
let mut matcher = Matcher::new(nucleo_matcher::Config::DEFAULT); let mut matcher = Matcher::new(nucleo_matcher::Config::DEFAULT);
let res = pat.match_list(items, &mut matcher); let res = pat.match_list(items, &mut matcher);
res.into_iter().map(|((item, _))| *item).collect::<Vec<_>>() res.into_iter().map(|(item, _)| *item).collect::<Vec<_>>()
} }
} }

View File

@ -1,10 +1,4 @@
use anyhow::Context; use octocrab::{models::Repository, params::repos::Sort, Octocrab, Page};
use octocrab::{
auth::Auth,
models::{hooks::Config, Repository},
params::repos::Sort,
NoSvc, Octocrab, Page,
};
use crate::{app::App, config::GitHubAccessToken}; use crate::{app::App, config::GitHubAccessToken};
@ -159,7 +153,7 @@ impl GitHubProvider {
fn get_client( fn get_client(
&self, &self,
url: Option<&String>, _url: Option<&String>,
access_token: &GitHubAccessToken, access_token: &GitHubAccessToken,
) -> anyhow::Result<Octocrab> { ) -> anyhow::Result<Octocrab> {
let client = octocrab::Octocrab::builder() let client = octocrab::Octocrab::builder()