diff --git a/Cargo.lock b/Cargo.lock index 4e84b565..a67214f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2576,6 +2576,7 @@ dependencies = [ "yazi-adaptor", "yazi-config", "yazi-prebuild", + "yazi-scheduler", "yazi-shared", ] @@ -2625,6 +2626,36 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "394457709d77af570fcb3c0ef878336213b4e9c8f298eccde728aecd602aa7e0" +[[package]] +name = "yazi-scheduler" +version = "0.1.5" +dependencies = [ + "anyhow", + "async-channel", + "bitflags 2.4.1", + "clipboard-win", + "crossterm", + "futures", + "indexmap", + "libc", + "notify", + "parking_lot", + "ratatui", + "regex", + "serde", + "serde_json", + "syntect", + "tokio", + "tokio-stream", + "tracing", + "trash", + "unicode-width", + "yazi-adaptor", + "yazi-config", + "yazi-prebuild", + "yazi-shared", +] + [[package]] name = "yazi-shared" version = "0.1.5" diff --git a/yazi-core/Cargo.toml b/yazi-core/Cargo.toml index d034d6b7..b7512d01 100644 --- a/yazi-core/Cargo.toml +++ b/yazi-core/Cargo.toml @@ -9,30 +9,31 @@ homepage = "https://yazi-rs.github.io" repository = "https://github.com/sxyazi/yazi" [dependencies] -yazi-adaptor = { path = "../yazi-adaptor", version = "0.1.5" } -yazi-config = { path = "../yazi-config", version = "0.1.5" } -yazi-shared = { path = "../yazi-shared", version = "0.1.5" } +yazi-adaptor = { path = "../yazi-adaptor", version = "0.1.5" } +yazi-config = { path = "../yazi-config", version = "0.1.5" } +yazi-scheduler = { path = "../yazi-scheduler", version = "0.1.5" } +yazi-shared = { path = "../yazi-shared", version = "0.1.5" } # External dependencies -anyhow = "^1" -async-channel = "^1" -bitflags = "^2" -crossterm = "^0" -futures = "^0" -indexmap = "^2" -libc = "^0" -notify = { version = "^6", default-features = false, features = [ "macos_fsevent" ] } -parking_lot = "^0" -ratatui = "^0" -regex = "^1" -serde = "^1" -serde_json = "^1" -syntect = { version = "^5", default-features = false, features = [ "parsing", "default-themes", "plist-load", "regex-onig" ] } -tokio = { version = "^1", features = [ "parking_lot", "macros", "rt-multi-thread", "sync", "time", "fs", "process", "io-std", "io-util" ] } -tokio-stream = "^0" -trash = "^3" -unicode-width = "^0" -yazi-prebuild = "^0" +anyhow = "^1" +async-channel = "^1" +bitflags = "^2" +crossterm = "^0" +futures = "^0" +indexmap = "^2" +libc = "^0" +notify = { version = "^6", default-features = false, features = [ "macos_fsevent" ] } +parking_lot = "^0" +ratatui = "^0" +regex = "^1" +serde = "^1" +serde_json = "^1" +syntect = { version = "^5", default-features = false, features = [ "parsing", "default-themes", "plist-load", "regex-onig" ] } +tokio = { version = "^1", features = [ "parking_lot", "macros", "rt-multi-thread", "sync", "time", "fs", "process", "io-std", "io-util" ] } +tokio-stream = "^0" +trash = "^3" +unicode-width = "^0" +yazi-prebuild = "^0" # Logging tracing = { version = "^0", features = [ "max_level_debug", "release_max_level_warn" ] } diff --git a/yazi-core/src/input/commands/paste.rs b/yazi-core/src/input/commands/paste.rs index 47783b01..98ec4d91 100644 --- a/yazi-core/src/input/commands/paste.rs +++ b/yazi-core/src/input/commands/paste.rs @@ -1,6 +1,7 @@ +use yazi_scheduler::external; use yazi_shared::event::Exec; -use crate::{external, input::{op::InputOp, Input}}; +use crate::input::{op::InputOp, Input}; pub struct Opt { before: bool, diff --git a/yazi-core/src/input/input.rs b/yazi-core/src/input/input.rs index 07fae677..2f23e697 100644 --- a/yazi-core/src/input/input.rs +++ b/yazi-core/src/input/input.rs @@ -3,10 +3,10 @@ use std::ops::Range; use tokio::sync::mpsc::UnboundedSender; use unicode_width::UnicodeWidthStr; use yazi_config::{popup::Position, INPUT}; +use yazi_scheduler::external; use yazi_shared::InputError; use super::{mode::InputMode, op::InputOp, InputSnap, InputSnaps}; -use crate::external; #[derive(Default)] pub struct Input { diff --git a/yazi-core/src/lib.rs b/yazi-core/src/lib.rs index ef525620..2cad03bc 100644 --- a/yazi-core/src/lib.rs +++ b/yazi-core/src/lib.rs @@ -9,7 +9,6 @@ mod blocker; pub mod completion; mod context; -pub mod external; pub mod files; pub mod help; mod highlighter; diff --git a/yazi-core/src/manager/commands/open.rs b/yazi-core/src/manager/commands/open.rs index db801322..029c6eb6 100644 --- a/yazi-core/src/manager/commands/open.rs +++ b/yazi-core/src/manager/commands/open.rs @@ -1,9 +1,10 @@ use std::ffi::OsString; use yazi_config::{popup::SelectCfg, OPEN}; +use yazi_scheduler::external; use yazi_shared::{event::Exec, MIME_DIR}; -use crate::{external, manager::Manager, select::Select, tasks::Tasks}; +use crate::{manager::Manager, select::Select, tasks::Tasks}; pub struct Opt { interactive: bool, diff --git a/yazi-core/src/manager/commands/rename.rs b/yazi-core/src/manager/commands/rename.rs index 77125ff5..89765522 100644 --- a/yazi-core/src/manager/commands/rename.rs +++ b/yazi-core/src/manager/commands/rename.rs @@ -3,9 +3,10 @@ use std::{collections::BTreeMap, ffi::OsStr, io::{stdout, BufWriter, Write}, pat use anyhow::{anyhow, bail, Result}; use tokio::{fs::{self, OpenOptions}, io::{stdin, AsyncReadExt, AsyncWriteExt}}; use yazi_config::{popup::InputCfg, OPEN, PREVIEW}; -use yazi_shared::{emit, event::Exec, fs::{File, FilesOp}, fs::{max_common_root, Url}, term::Term, Defer}; +use yazi_scheduler::external::{self, ShellOpt}; +use yazi_shared::{emit, event::Exec, fs::{max_common_root, File, FilesOp, Url}, term::Term, Defer}; -use crate::{external::{self, ShellOpt}, input::Input, manager::Manager, Ctx, BLOCKER}; +use crate::{input::Input, manager::Manager, Ctx, BLOCKER}; pub struct Opt { force: bool, diff --git a/yazi-core/src/manager/watcher.rs b/yazi-core/src/manager/watcher.rs index 6e9ba6fc..ac62a0c9 100644 --- a/yazi-core/src/manager/watcher.rs +++ b/yazi-core/src/manager/watcher.rs @@ -5,9 +5,10 @@ use notify::{event::{MetadataKind, ModifyKind}, EventKind, RecommendedWatcher, R use parking_lot::RwLock; use tokio::{fs, pin, sync::mpsc::{self, UnboundedReceiver}}; use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt}; -use yazi_shared::{emit, fs::{File, FilesOp}, fs::Url}; +use yazi_scheduler::external; +use yazi_shared::{emit, fs::{File, FilesOp, Url}}; -use crate::{external, files::Files}; +use crate::files::Files; pub struct Watcher { watcher: RecommendedWatcher, diff --git a/yazi-core/src/preview/provider.rs b/yazi-core/src/preview/provider.rs index 9fa4adfc..09e0df68 100644 --- a/yazi-core/src/preview/provider.rs +++ b/yazi-core/src/preview/provider.rs @@ -3,9 +3,10 @@ use std::path::Path; use tokio::fs; use yazi_adaptor::ADAPTOR; use yazi_config::{MANAGER, PREVIEW}; +use yazi_scheduler::external; use yazi_shared::{event::PreviewData, MimeKind, PeekError}; -use crate::{external, Highlighter}; +use crate::Highlighter; pub(super) struct Provider; diff --git a/yazi-core/src/tab/commands/copy.rs b/yazi-core/src/tab/commands/copy.rs index 805619fa..15d5622d 100644 --- a/yazi-core/src/tab/commands/copy.rs +++ b/yazi-core/src/tab/commands/copy.rs @@ -1,8 +1,9 @@ use std::ffi::{OsStr, OsString}; +use yazi_scheduler::external; use yazi_shared::event::Exec; -use crate::{external, tab::Tab}; +use crate::tab::Tab; pub struct Opt<'a> { type_: &'a str, diff --git a/yazi-core/src/tab/commands/jump.rs b/yazi-core/src/tab/commands/jump.rs index 3cb3e69d..9427c636 100644 --- a/yazi-core/src/tab/commands/jump.rs +++ b/yazi-core/src/tab/commands/jump.rs @@ -1,6 +1,7 @@ +use yazi_scheduler::external::{self, FzfOpt, ZoxideOpt}; use yazi_shared::{event::Exec, fs::ends_with_slash, Defer}; -use crate::{external::{self, FzfOpt, ZoxideOpt}, tab::Tab, Ctx, BLOCKER}; +use crate::{tab::Tab, Ctx, BLOCKER}; pub struct Opt { type_: OptType, diff --git a/yazi-core/src/tab/commands/search.rs b/yazi-core/src/tab/commands/search.rs index b6ccbaf2..69e2176f 100644 --- a/yazi-core/src/tab/commands/search.rs +++ b/yazi-core/src/tab/commands/search.rs @@ -4,9 +4,10 @@ use anyhow::bail; use tokio::pin; use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt}; use yazi_config::popup::InputCfg; +use yazi_scheduler::external; use yazi_shared::{emit, event::Exec, fs::FilesOp}; -use crate::{external, input::Input, manager::Manager, tab::Tab}; +use crate::{input::Input, manager::Manager, tab::Tab}; pub struct Opt { pub type_: OptType, diff --git a/yazi-core/src/tasks/workers/precache.rs b/yazi-core/src/tasks/workers/precache.rs index 3b383fe9..78d366a4 100644 --- a/yazi-core/src/tasks/workers/precache.rs +++ b/yazi-core/src/tasks/workers/precache.rs @@ -5,9 +5,10 @@ use parking_lot::Mutex; use tokio::{fs, sync::mpsc}; use yazi_adaptor::Image; use yazi_config::PREVIEW; +use yazi_scheduler::external; use yazi_shared::{emit, fs::{calculate_size, FilesOp, Url}, Throttle}; -use crate::{external, tasks::TaskOp}; +use crate::tasks::TaskOp; pub(crate) struct Precache { tx: async_channel::Sender, diff --git a/yazi-core/src/tasks/workers/process.rs b/yazi-core/src/tasks/workers/process.rs index 3707d655..1a3a95d8 100644 --- a/yazi-core/src/tasks/workers/process.rs +++ b/yazi-core/src/tasks/workers/process.rs @@ -2,8 +2,9 @@ use std::{ffi::OsString, mem}; use anyhow::Result; use tokio::{io::{AsyncBufReadExt, BufReader}, select, sync::{mpsc, oneshot}}; +use yazi_scheduler::external::{self, ShellOpt}; -use crate::{external::{self, ShellOpt}, tasks::TaskOp, Ctx, BLOCKER}; +use crate::{tasks::TaskOp, Ctx, BLOCKER}; pub(crate) struct Process { sch: mpsc::UnboundedSender, diff --git a/yazi-scheduler/Cargo.toml b/yazi-scheduler/Cargo.toml new file mode 100644 index 00000000..b3fe42ca --- /dev/null +++ b/yazi-scheduler/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "yazi-scheduler" +version = "0.1.5" +edition = "2021" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi task scheduler" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" + +[dependencies] +yazi-adaptor = { path = "../yazi-adaptor", version = "0.1.5" } +yazi-config = { path = "../yazi-config", version = "0.1.5" } +yazi-shared = { path = "../yazi-shared", version = "0.1.5" } + +# External dependencies +anyhow = "^1" +async-channel = "^1" +bitflags = "^2" +crossterm = "^0" +futures = "^0" +indexmap = "^2" +libc = "^0" +notify = { version = "^6", default-features = false, features = [ "macos_fsevent" ] } +parking_lot = "^0" +ratatui = "^0" +regex = "^1" +serde = "^1" +serde_json = "^1" +syntect = { version = "^5", default-features = false, features = [ "parsing", "default-themes", "plist-load", "regex-onig" ] } +tokio = { version = "^1", features = [ "parking_lot", "macros", "rt-multi-thread", "sync", "time", "fs", "process", "io-std", "io-util" ] } +tokio-stream = "^0" +trash = "^3" +unicode-width = "^0" +yazi-prebuild = "^0" + +# Logging +tracing = { version = "^0", features = [ "max_level_debug", "release_max_level_warn" ] } + +[target."cfg(windows)".dependencies] +clipboard-win = "^4" diff --git a/yazi-core/src/external/clipboard.rs b/yazi-scheduler/src/external/clipboard.rs similarity index 100% rename from yazi-core/src/external/clipboard.rs rename to yazi-scheduler/src/external/clipboard.rs diff --git a/yazi-core/src/external/fd.rs b/yazi-scheduler/src/external/fd.rs similarity index 100% rename from yazi-core/src/external/fd.rs rename to yazi-scheduler/src/external/fd.rs diff --git a/yazi-core/src/external/ffmpegthumbnailer.rs b/yazi-scheduler/src/external/ffmpegthumbnailer.rs similarity index 100% rename from yazi-core/src/external/ffmpegthumbnailer.rs rename to yazi-scheduler/src/external/ffmpegthumbnailer.rs diff --git a/yazi-core/src/external/file.rs b/yazi-scheduler/src/external/file.rs similarity index 100% rename from yazi-core/src/external/file.rs rename to yazi-scheduler/src/external/file.rs diff --git a/yazi-core/src/external/fzf.rs b/yazi-scheduler/src/external/fzf.rs similarity index 100% rename from yazi-core/src/external/fzf.rs rename to yazi-scheduler/src/external/fzf.rs diff --git a/yazi-core/src/external/jq.rs b/yazi-scheduler/src/external/jq.rs similarity index 100% rename from yazi-core/src/external/jq.rs rename to yazi-scheduler/src/external/jq.rs diff --git a/yazi-core/src/external/lsar.rs b/yazi-scheduler/src/external/lsar.rs similarity index 100% rename from yazi-core/src/external/lsar.rs rename to yazi-scheduler/src/external/lsar.rs diff --git a/yazi-core/src/external/mod.rs b/yazi-scheduler/src/external/mod.rs similarity index 100% rename from yazi-core/src/external/mod.rs rename to yazi-scheduler/src/external/mod.rs diff --git a/yazi-core/src/external/pdftoppm.rs b/yazi-scheduler/src/external/pdftoppm.rs similarity index 100% rename from yazi-core/src/external/pdftoppm.rs rename to yazi-scheduler/src/external/pdftoppm.rs diff --git a/yazi-core/src/external/rg.rs b/yazi-scheduler/src/external/rg.rs similarity index 100% rename from yazi-core/src/external/rg.rs rename to yazi-scheduler/src/external/rg.rs diff --git a/yazi-core/src/external/shell.rs b/yazi-scheduler/src/external/shell.rs similarity index 100% rename from yazi-core/src/external/shell.rs rename to yazi-scheduler/src/external/shell.rs diff --git a/yazi-core/src/external/unar.rs b/yazi-scheduler/src/external/unar.rs similarity index 100% rename from yazi-core/src/external/unar.rs rename to yazi-scheduler/src/external/unar.rs diff --git a/yazi-core/src/external/zoxide.rs b/yazi-scheduler/src/external/zoxide.rs similarity index 100% rename from yazi-core/src/external/zoxide.rs rename to yazi-scheduler/src/external/zoxide.rs diff --git a/yazi-scheduler/src/lib.rs b/yazi-scheduler/src/lib.rs new file mode 100644 index 00000000..2e9488b8 --- /dev/null +++ b/yazi-scheduler/src/lib.rs @@ -0,0 +1 @@ +pub mod external;