Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ext() method to Url userdata #1528

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 45 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ crossterm = { version = "0.27.0", features = [ "event-stream" ] }
dirs = "5.0.1"
futures = "0.3.30"
globset = "0.4.14"
libc = "0.2.156"
libc = "0.2.158"
md-5 = "0.10.6"
mlua = { version = "0.9.9", features = [ "lua54", "serialize", "macros", "async" ] }
parking_lot = "0.12.3"
Expand All @@ -30,7 +30,7 @@ scopeguard = "1.2.0"
serde = { version = "1.0.208", features = [ "derive" ] }
serde_json = "1.0.125"
shell-words = "1.1.0"
tokio = { version = "1.39.2", features = [ "full" ] }
tokio = { version = "1.39.3", features = [ "full" ] }
tokio-stream = "0.1.15"
tokio-util = "0.7.11"
tracing = { version = "0.1.40", features = [ "max_level_debug", "release_max_level_warn" ] }
Expand Down
2 changes: 1 addition & 1 deletion yazi-boot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ serde = { workspace = true }

[build-dependencies]
clap = { workspace = true }
clap_complete = "4.5.16"
clap_complete = "4.5.19"
clap_complete_fig = "4.5.2"
clap_complete_nushell = "4.5.3"
vergen-gitcl = { version = "1.0.0", features = [ "build" ] }
2 changes: 1 addition & 1 deletion yazi-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ yazi-shared = { path = "../yazi-shared", version = "0.3.1" }
# External build dependencies
anyhow = { workspace = true }
clap = { workspace = true }
clap_complete = "4.5.16"
clap_complete = "4.5.19"
clap_complete_fig = "4.5.2"
clap_complete_nushell = "4.5.3"
serde_json = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions yazi-config/src/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ pub struct Pattern {

impl Pattern {
#[inline]
pub fn match_mime(&self, str: impl AsRef<str>) -> bool {
self.is_star || self.inner.is_match(str.as_ref())
pub fn match_mime(&self, mime: impl AsRef<str>) -> bool {
self.is_star || (!mime.as_ref().is_empty() && self.inner.is_match(mime.as_ref()))
}

#[inline]
Expand Down
6 changes: 3 additions & 3 deletions yazi-config/src/plugin/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ pub struct Fetcher {

impl Fetcher {
#[inline]
pub fn matches(&self, path: &Path, mime: Option<&str>, f: impl Fn(&str) -> bool + Copy) -> bool {
pub fn matches(&self, path: &Path, mime: &str, f: impl Fn(&str) -> bool + Copy) -> bool {
self.if_.as_ref().and_then(|c| c.eval(f)) != Some(false)
&& (self.mime.as_ref().zip(mime).map_or(false, |(p, m)| p.match_mime(m))
|| self.name.as_ref().is_some_and(|p| p.match_path(path, mime == Some(MIME_DIR))))
&& (self.mime.as_ref().is_some_and(|p| p.match_mime(mime))
|| self.name.as_ref().is_some_and(|p| p.match_path(path, mime == MIME_DIR)))
}
}

Expand Down
4 changes: 2 additions & 2 deletions yazi-config/src/plugin/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Plugin {
pub fn fetchers<'a>(
&'a self,
path: &'a Path,
mime: Option<&'a str>,
mime: &'a str,
factor: impl Fn(&str) -> bool + Copy,
) -> impl Iterator<Item = &'a Fetcher> {
let mut seen = HashSet::new();
Expand All @@ -32,7 +32,7 @@ impl Plugin {
pub fn preloaders<'a>(
&'a self,
path: &'a Path,
mime: Option<&'a str>,
mime: &'a str,
) -> impl Iterator<Item = &'a Preloader> {
let mut next = true;
self.preloaders.iter().filter(move |&p| {
Expand Down
Loading