mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
4d7d2ef082
commit
511ce675fb
49 changed files with 55 additions and 54 deletions
|
|
@ -3,7 +3,7 @@ use std::{fs::File, io::BufReader, path::{Path, PathBuf}};
|
|||
use anyhow::Result;
|
||||
use image::{imageops::FilterType, io::Limits, DynamicImage, ImageFormat};
|
||||
use yazi_config::{PREVIEW, TASKS};
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
pub struct Image;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use anyhow::Result;
|
|||
use base64::{engine::general_purpose, Engine};
|
||||
use image::{codecs::jpeg::JpegEncoder, DynamicImage};
|
||||
use ratatui::prelude::Rect;
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use super::image::Image;
|
||||
use crate::{CLOSE, START};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use anyhow::Result;
|
|||
use base64::{engine::general_purpose, Engine};
|
||||
use image::DynamicImage;
|
||||
use ratatui::prelude::Rect;
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use super::image::Image;
|
||||
use crate::{CLOSE, ESCAPE, START};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use anyhow::Result;
|
|||
use base64::{engine::general_purpose, Engine};
|
||||
use image::DynamicImage;
|
||||
use ratatui::prelude::Rect;
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use super::image::Image;
|
||||
use crate::{CLOSE, ESCAPE, START};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use anyhow::{bail, Result};
|
|||
use color_quant::NeuQuant;
|
||||
use image::DynamicImage;
|
||||
use ratatui::prelude::Rect;
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use crate::{Image, CLOSE, ESCAPE, START};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use anyhow::bail;
|
|||
use crossterm::terminal::WindowSize;
|
||||
use ratatui::{prelude::Rect, widgets::{Block, Padding}};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use crate::{PREVIEW, THEME};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crossterm::terminal::WindowSize;
|
||||
use ratatui::layout::Rect;
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use super::{Offset, Origin};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use anyhow::Result;
|
|||
use crossterm::event::KeyEvent;
|
||||
use tokio::sync::{mpsc::{self, UnboundedSender}, oneshot};
|
||||
use yazi_config::{keymap::{Exec, KeymapLayer}, open::Opener, popup::{InputOpt, SelectOpt}};
|
||||
use yazi_shared::{InputError, RoCell, Url};
|
||||
use yazi_shared::{fs::Url, InputError, RoCell};
|
||||
|
||||
use super::files::FilesOp;
|
||||
use crate::{preview::PreviewLock, tasks::TasksProgress};
|
||||
|
|
|
|||
2
yazi-core/src/external/fd.rs
vendored
2
yazi-core/src/external/fd.rs
vendored
|
|
@ -2,7 +2,7 @@ use std::process::Stdio;
|
|||
|
||||
use anyhow::Result;
|
||||
use tokio::{io::{AsyncBufReadExt, BufReader}, process::Command, sync::mpsc::{self, UnboundedReceiver}};
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::files::File;
|
||||
|
||||
|
|
|
|||
2
yazi-core/src/external/file.rs
vendored
2
yazi-core/src/external/file.rs
vendored
|
|
@ -4,7 +4,7 @@ use anyhow::{bail, Result};
|
|||
use futures::TryFutureExt;
|
||||
use tokio::process::Command;
|
||||
use tracing::error;
|
||||
use yazi_shared::{MimeKind, Url};
|
||||
use yazi_shared::{fs::Url, MimeKind};
|
||||
|
||||
async fn _file(files: &[&Url]) -> Result<BTreeMap<Url, String>> {
|
||||
if files.is_empty() {
|
||||
|
|
|
|||
2
yazi-core/src/external/fzf.rs
vendored
2
yazi-core/src/external/fzf.rs
vendored
|
|
@ -2,7 +2,7 @@ use std::{path::Path, process::Stdio};
|
|||
|
||||
use anyhow::{bail, Result};
|
||||
use tokio::process::Command;
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
pub struct FzfOpt {
|
||||
pub cwd: Url,
|
||||
|
|
|
|||
2
yazi-core/src/external/rg.rs
vendored
2
yazi-core/src/external/rg.rs
vendored
|
|
@ -2,7 +2,7 @@ use std::process::Stdio;
|
|||
|
||||
use anyhow::Result;
|
||||
use tokio::{io::{AsyncBufReadExt, BufReader}, process::Command, sync::mpsc::{self, UnboundedReceiver}};
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::files::File;
|
||||
|
||||
|
|
|
|||
2
yazi-core/src/external/zoxide.rs
vendored
2
yazi-core/src/external/zoxide.rs
vendored
|
|
@ -2,7 +2,7 @@ use std::process::Stdio;
|
|||
|
||||
use anyhow::{bail, Result};
|
||||
use tokio::process::Command;
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
pub struct ZoxideOpt {
|
||||
pub cwd: Url,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{borrow::Cow, collections::BTreeMap, ffi::OsStr, fs::Metadata, ops::Der
|
|||
|
||||
use anyhow::Result;
|
||||
use tokio::fs;
|
||||
use yazi_shared::{Cha, ChaKind, Url};
|
||||
use yazi_shared::fs::{Cha, ChaKind, Url};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct File {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::{collections::{BTreeMap, BTreeSet}, mem, ops::Deref, sync::atomic::Orde
|
|||
use anyhow::Result;
|
||||
use tokio::{fs, select, sync::mpsc::{self, UnboundedReceiver}};
|
||||
use yazi_config::{manager::SortBy, MANAGER};
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use super::{File, FilesSorter, FILES_TICKET};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::{collections::{BTreeMap, BTreeSet}, sync::atomic::{AtomicU64, Ordering}};
|
||||
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use super::File;
|
||||
use crate::emit;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::{cmp::Ordering, collections::BTreeMap, mem};
|
||||
|
||||
use yazi_config::manager::SortBy;
|
||||
use yazi_shared::{natsort, Url};
|
||||
use yazi_shared::{fs::Url, natsort};
|
||||
|
||||
use super::File;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crossterm::event::KeyCode;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
use yazi_config::{keymap::{Control, Key, KeymapLayer}, KEYMAP};
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use super::HELP_MARGIN;
|
||||
use crate::input::Input;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::path::{PathBuf, MAIN_SEPARATOR};
|
|||
|
||||
use tokio::fs;
|
||||
use yazi_config::{keymap::Exec, popup::InputOpt};
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::{emit, files::{File, FilesOp}, manager::Manager};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::collections::BTreeSet;
|
||||
|
||||
use yazi_config::keymap::{Exec, KeymapLayer};
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::{emit, manager::Manager};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use yazi_config::{keymap::{Exec, KeymapLayer}, MANAGER};
|
||||
use yazi_shared::{Url, MIME_DIR};
|
||||
use yazi_shared::{fs::Url, MIME_DIR};
|
||||
|
||||
use crate::{emit, manager::Manager};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ 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::{keymap::Exec, popup::InputOpt, OPEN, PREVIEW};
|
||||
use yazi_shared::{max_common_root, Defer, Term, Url};
|
||||
use yazi_shared::{fs::{max_common_root, Url}, term::Term, Defer};
|
||||
|
||||
use crate::{emit, external::{self, ShellOpt}, files::{File, FilesOp}, manager::Manager, Event, BLOCKER};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use yazi_config::keymap::Exec;
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::{manager::Tabs, tab::Tab};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use super::{Tabs, Watcher};
|
||||
use crate::{files::{File, FilesOp}, tab::{Folder, Tab}, tasks::Tasks};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use yazi_config::BOOT;
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::{manager::Manager, tab::Tab};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ 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::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::{emit, external, files::{File, Files, FilesOp}};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use tokio::{pin, task::JoinHandle};
|
|||
use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt};
|
||||
use yazi_adaptor::ADAPTOR;
|
||||
use yazi_config::MANAGER;
|
||||
use yazi_shared::{Cha, MimeKind, PeekError, Url};
|
||||
use yazi_shared::{fs::{Cha, Url}, MimeKind, PeekError};
|
||||
|
||||
use super::Provider;
|
||||
use crate::{emit, files::{Files, FilesOp}, manager::Manager, Highlighter};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::{mem, time::Duration};
|
|||
use tokio::{fs, pin};
|
||||
use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt};
|
||||
use yazi_config::{keymap::{Exec, KeymapLayer}, popup::InputOpt};
|
||||
use yazi_shared::{expand_path, Debounce, InputError, Url};
|
||||
use yazi_shared::{expand_path, fs::Url, Debounce, InputError};
|
||||
|
||||
use crate::{completion::Completion, emit, manager::Manager, tab::Tab};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use yazi_config::keymap::{Exec, KeymapLayer};
|
||||
use yazi_shared::{expand_path, Url};
|
||||
use yazi_shared::{expand_path, fs::Url};
|
||||
|
||||
use crate::{emit, files::{File, FilesOp}, manager::Manager, tab::Tab};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{collections::BTreeMap, ffi::OsStr, ops::Range};
|
|||
|
||||
use anyhow::Result;
|
||||
use regex::bytes::{Regex, RegexBuilder};
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::files::Files;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use ratatui::layout::Rect;
|
||||
use yazi_config::MANAGER;
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use crate::{emit, files::{File, Files, FilesOp}, Step};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{borrow::Cow, collections::BTreeMap};
|
|||
|
||||
use anyhow::Result;
|
||||
use tokio::task::JoinHandle;
|
||||
use yazi_shared::Url;
|
||||
use yazi_shared::fs::Url;
|
||||
|
||||
use super::{Backstack, Config, Finder, Folder, Mode};
|
||||
use crate::{files::File, preview::{Preview, PreviewLock}};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::io::{stdout, Write};
|
|||
use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
|
||||
use tokio::{io::{stdin, AsyncReadExt}, select, sync::mpsc, time};
|
||||
use yazi_config::keymap::Exec;
|
||||
use yazi_shared::{Defer, Term};
|
||||
use yazi_shared::{term::Term, Defer};
|
||||
|
||||
use crate::{emit, tasks::Tasks, Event, BLOCKER};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use futures::{future::BoxFuture, FutureExt};
|
|||
use parking_lot::RwLock;
|
||||
use tokio::{fs, select, sync::{mpsc::{self, UnboundedReceiver}, oneshot}, time::sleep};
|
||||
use yazi_config::{open::Opener, TASKS};
|
||||
use yazi_shared::{unique_path, Throttle, Url};
|
||||
use yazi_shared::{fs::Url, unique_path, Throttle};
|
||||
|
||||
use super::{workers::{File, FileOpDelete, FileOpLink, FileOpPaste, FileOpTrash, Precache, PrecacheOpMime, PrecacheOpSize, Process, ProcessOpOpen}, Running, TaskOp, TaskStage, TasksProgress};
|
||||
use crate::emit;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::{collections::{BTreeMap, HashMap, HashSet}, ffi::OsStr, path::Path, syn
|
|||
use serde::Serialize;
|
||||
use tracing::debug;
|
||||
use yazi_config::{manager::SortBy, open::Opener, popup::InputOpt, OPEN};
|
||||
use yazi_shared::{MimeKind, Term, Url};
|
||||
use yazi_shared::{fs::Url, term::Term, MimeKind};
|
||||
|
||||
use super::{running::Running, task::TaskSummary, Scheduler, TASKS_PADDING, TASKS_PERCENT};
|
||||
use crate::{emit, files::{File, Files}};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use futures::{future::BoxFuture, FutureExt};
|
|||
use tokio::{fs, io::{self, ErrorKind::{AlreadyExists, NotFound}}, sync::mpsc};
|
||||
use tracing::warn;
|
||||
use yazi_config::TASKS;
|
||||
use yazi_shared::{calculate_size, copy_with_progress, path_relative_to, Url};
|
||||
use yazi_shared::{fs::{calculate_size, copy_with_progress, Url}, path_relative_to};
|
||||
|
||||
use crate::tasks::TaskOp;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use parking_lot::Mutex;
|
|||
use tokio::{fs, sync::mpsc};
|
||||
use yazi_adaptor::Image;
|
||||
use yazi_config::PREVIEW;
|
||||
use yazi_shared::{calculate_size, Throttle, Url};
|
||||
use yazi_shared::{fs::{calculate_size, Url}, Throttle};
|
||||
|
||||
use crate::{emit, external, files::FilesOp, tasks::TaskOp};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use ratatui::{backend::Backend, prelude::Rect};
|
|||
use tokio::sync::oneshot;
|
||||
use yazi_config::{keymap::{Exec, Key, KeymapLayer}, BOOT};
|
||||
use yazi_core::{emit, files::FilesOp, input::InputMode, manager::Manager, preview::COLLISION, Ctx, Event};
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use crate::{Executor, Logs, Panic, Root, Signals};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use ansi_to_tui::IntoText;
|
|||
use ratatui::{buffer::Buffer, layout::Rect, text::{Line, Text}, widgets::{Block, BorderType, Borders, Paragraph, Widget}};
|
||||
use yazi_config::THEME;
|
||||
use yazi_core::{input::InputMode, Ctx};
|
||||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
use crate::widgets;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use yazi_shared::Term;
|
||||
use yazi_shared::term::Term;
|
||||
|
||||
pub(super) struct Panic;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ impl Files {
|
|||
reg.add_method("permissions", |_, me, ()| {
|
||||
Ok(
|
||||
#[cfg(unix)]
|
||||
Some(yazi_shared::permissions(me.permissions)),
|
||||
Some(yazi_shared::fs::permissions(me.permissions)),
|
||||
#[cfg(windows)]
|
||||
None::<String>,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ where
|
|||
}
|
||||
|
||||
// --- Url
|
||||
pub struct Url(yazi_shared::Url);
|
||||
pub struct Url(yazi_shared::fs::Url);
|
||||
|
||||
impl From<&yazi_shared::Url> for Url {
|
||||
fn from(value: &yazi_shared::Url) -> Self { Self(value.clone()) }
|
||||
impl From<&yazi_shared::fs::Url> for Url {
|
||||
fn from(value: &yazi_shared::fs::Url) -> Self { Self(value.clone()) }
|
||||
}
|
||||
|
||||
impl UserData for Url {
|
||||
|
|
|
|||
7
yazi-shared/src/fs/mod.rs
Normal file
7
yazi-shared/src/fs/mod.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
mod cha;
|
||||
mod fs;
|
||||
mod url;
|
||||
|
||||
pub use cha::*;
|
||||
pub use fs::*;
|
||||
pub use url::*;
|
||||
|
|
@ -1,33 +1,27 @@
|
|||
#![allow(clippy::option_map_unit_fn)]
|
||||
|
||||
mod cha;
|
||||
mod chars;
|
||||
mod debounce;
|
||||
mod defer;
|
||||
mod errors;
|
||||
mod fns;
|
||||
mod fs;
|
||||
pub mod fs;
|
||||
mod mime;
|
||||
mod natsort;
|
||||
mod path;
|
||||
mod ro_cell;
|
||||
mod term;
|
||||
pub mod term;
|
||||
mod throttle;
|
||||
mod time;
|
||||
mod url;
|
||||
|
||||
pub use cha::*;
|
||||
pub use chars::*;
|
||||
pub use debounce::*;
|
||||
pub use defer::*;
|
||||
pub use errors::*;
|
||||
pub use fns::*;
|
||||
pub use fs::*;
|
||||
pub use mime::*;
|
||||
pub use natsort::*;
|
||||
pub use path::*;
|
||||
pub use ro_cell::*;
|
||||
pub use term::*;
|
||||
pub use throttle::*;
|
||||
pub use time::*;
|
||||
pub use url::*;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::{borrow::Cow, env, ffi::OsString, path::{Component, Path, PathBuf, MAIN
|
|||
|
||||
use tokio::fs;
|
||||
|
||||
use crate::Url;
|
||||
use crate::fs::Url;
|
||||
|
||||
#[inline]
|
||||
pub fn current_cwd() -> Option<PathBuf> {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::io::{stdout, Write};
|
|||
use anyhow::Result;
|
||||
use crossterm::{cursor::{MoveTo, RestorePosition, SavePosition, SetCursorStyle}, execute, queue};
|
||||
|
||||
use crate::Term;
|
||||
use super::Term;
|
||||
|
||||
impl Term {
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue