This commit is contained in:
sxyazi 2023-11-28 20:28:53 +08:00
parent 954b10b388
commit 66a3e7efaa
No known key found for this signature in database
29 changed files with 119 additions and 36 deletions

31
Cargo.lock generated
View file

@ -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"

View file

@ -11,6 +11,7 @@ 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-scheduler = { path = "../yazi-scheduler", version = "0.1.5" }
yazi-shared = { path = "../yazi-shared", version = "0.1.5" }
# External dependencies

View file

@ -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,

View file

@ -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 {

View file

@ -9,7 +9,6 @@
mod blocker;
pub mod completion;
mod context;
pub mod external;
pub mod files;
pub mod help;
mod highlighter;

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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;

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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<PrecacheOp>,

View file

@ -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<TaskOp>,

41
yazi-scheduler/Cargo.toml Normal file
View file

@ -0,0 +1,41 @@
[package]
name = "yazi-scheduler"
version = "0.1.5"
edition = "2021"
license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ]
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"

View file

@ -0,0 +1 @@
pub mod external;