Compare commits
1 Commits
849bc8a5f2
...
6ce5ef7d79
Author | SHA1 | Date | |
---|---|---|---|
|
6ce5ef7d79 |
@ -12,7 +12,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- implement naive fuzzy matcher
|
||||
|
||||
### Other
|
||||
- cleanup warnings
|
||||
- move fuzzy search out of command
|
||||
- refactor/matcher move to a separate file
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use nucleo_matcher::{pattern::Pattern, Matcher, Utf32Str};
|
||||
|
||||
use crate::{
|
||||
app::App, cache::CacheApp, fuzzy_matcher::FuzzyMatcherApp, projects_list::ProjectsListApp,
|
||||
};
|
||||
@ -53,11 +55,11 @@ impl RootCommand {
|
||||
}
|
||||
|
||||
trait StringExt {
|
||||
fn as_str_vec(&self) -> Vec<&str>;
|
||||
fn as_str_vec<'a>(&'a self) -> Vec<&'a str>;
|
||||
}
|
||||
|
||||
impl StringExt for Vec<String> {
|
||||
fn as_str_vec(&self) -> Vec<&str> {
|
||||
fn as_str_vec<'a>(&'a self) -> Vec<&'a str> {
|
||||
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> {
|
||||
let pat = Pattern::new(
|
||||
pattern,
|
||||
&pattern,
|
||||
nucleo_matcher::pattern::CaseMatching::Ignore,
|
||||
nucleo_matcher::pattern::Normalization::Smart,
|
||||
nucleo_matcher::pattern::AtomKind::Fuzzy,
|
||||
@ -19,7 +19,7 @@ impl FuzzyMatcher {
|
||||
let mut matcher = Matcher::new(nucleo_matcher::Config::DEFAULT);
|
||||
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,4 +1,10 @@
|
||||
use octocrab::{models::Repository, params::repos::Sort, Octocrab, Page};
|
||||
use anyhow::Context;
|
||||
use octocrab::{
|
||||
auth::Auth,
|
||||
models::{hooks::Config, Repository},
|
||||
params::repos::Sort,
|
||||
NoSvc, Octocrab, Page,
|
||||
};
|
||||
|
||||
use crate::{app::App, config::GitHubAccessToken};
|
||||
|
||||
@ -153,7 +159,7 @@ impl GitHubProvider {
|
||||
|
||||
fn get_client(
|
||||
&self,
|
||||
_url: Option<&String>,
|
||||
url: Option<&String>,
|
||||
access_token: &GitHubAccessToken,
|
||||
) -> anyhow::Result<Octocrab> {
|
||||
let client = octocrab::Octocrab::builder()
|
||||
|
Loading…
Reference in New Issue
Block a user