-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a
next
property to the preloader rules to allow running m…
…ultiple preloaders (#1058)
- Loading branch information
Showing
28 changed files
with
219 additions
and
189 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
mod plugin; | ||
mod props; | ||
mod rule; | ||
mod run; | ||
mod preloader; | ||
mod previewer; | ||
|
||
pub use plugin::*; | ||
pub use props::*; | ||
pub use rule::*; | ||
#[allow(unused_imports)] | ||
pub use run::*; | ||
pub use preloader::*; | ||
pub use previewer::*; | ||
|
||
pub const MAX_PRELOADERS: u8 = 32; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use serde::Deserialize; | ||
use yazi_shared::{event::Cmd, Condition}; | ||
|
||
use crate::{Pattern, Priority}; | ||
|
||
#[derive(Debug, Deserialize)] | ||
pub struct Preloader { | ||
#[serde(skip)] | ||
pub id: u8, | ||
pub cond: Option<Condition>, | ||
pub name: Option<Pattern>, | ||
pub mime: Option<Pattern>, | ||
pub run: Cmd, | ||
#[serde(default)] | ||
pub next: bool, | ||
#[serde(default)] | ||
pub multi: bool, | ||
#[serde(default)] | ||
pub prio: Priority, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct PreloaderProps { | ||
pub id: u8, | ||
pub name: String, | ||
pub multi: bool, | ||
pub prio: Priority, | ||
} | ||
|
||
impl From<&Preloader> for PreloaderProps { | ||
fn from(preloader: &Preloader) -> Self { | ||
Self { | ||
id: preloader.id, | ||
name: preloader.run.name.to_owned(), | ||
multi: preloader.multi, | ||
prio: preloader.prio, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use serde::Deserialize; | ||
use yazi_shared::event::Cmd; | ||
|
||
use crate::Pattern; | ||
|
||
#[derive(Debug, Deserialize)] | ||
pub struct Previewer { | ||
pub name: Option<Pattern>, | ||
pub mime: Option<Pattern>, | ||
pub run: Cmd, | ||
#[serde(default)] | ||
pub sync: bool, | ||
} | ||
|
||
impl Previewer { | ||
#[inline] | ||
pub fn any_file(&self) -> bool { self.name.as_ref().is_some_and(|p| p.any_file()) } | ||
|
||
#[inline] | ||
pub fn any_dir(&self) -> bool { self.name.as_ref().is_some_and(|p| p.any_dir()) } | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.