Compare commits
2 Commits
6ce5ef7d79
...
849bc8a5f2
Author | SHA1 | Date | |
---|---|---|---|
|
849bc8a5f2 | ||
c2dfd020bf |
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- implement naive fuzzy matcher
|
- implement naive fuzzy matcher
|
||||||
|
|
||||||
### Other
|
### Other
|
||||||
|
- cleanup warnings
|
||||||
- move fuzzy search out of command
|
- move fuzzy search out of command
|
||||||
- refactor/matcher move to a separate file
|
- refactor/matcher move to a separate 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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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<_>>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user