diff --git a/yazi-cli/src/package/git.rs b/yazi-cli/src/package/git.rs index 58004792..ab6d97d9 100644 --- a/yazi-cli/src/package/git.rs +++ b/yazi-cli/src/package/git.rs @@ -16,7 +16,7 @@ impl Git { } pub(super) async fn checkout(path: &Path, rev: &str) -> Result<()> { - Self::exec(|c| c.args(["checkout", rev]).current_dir(path)).await + Self::exec(|c| c.args(["checkout", rev, "--force"]).current_dir(path)).await } pub(super) async fn pull(path: &Path) -> Result<()> { diff --git a/yazi-config/src/lib.rs b/yazi-config/src/lib.rs index 8107b79a..1d3ff20e 100644 --- a/yazi-config/src/lib.rs +++ b/yazi-config/src/lib.rs @@ -1,6 +1,6 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_pub!(keymap mgr open opener plugin popup preview scheme tasks theme which); +yazi_macro::mod_pub!(keymap mgr open opener plugin popup preview tasks theme vfs which); yazi_macro::mod_flat!(color icon layout pattern platform preset priority style yazi); diff --git a/yazi-config/src/scheme/mod.rs b/yazi-config/src/vfs/mod.rs similarity index 100% rename from yazi-config/src/scheme/mod.rs rename to yazi-config/src/vfs/mod.rs diff --git a/yazi-config/src/scheme/sftp.rs b/yazi-config/src/vfs/sftp.rs similarity index 100% rename from yazi-config/src/scheme/sftp.rs rename to yazi-config/src/vfs/sftp.rs diff --git a/yazi-fs/src/provider/mod.rs b/yazi-fs/src/provider/mod.rs index c1d7908e..ce56650e 100644 --- a/yazi-fs/src/provider/mod.rs +++ b/yazi-fs/src/provider/mod.rs @@ -1,3 +1,3 @@ -yazi_macro::mod_pub!(local); +yazi_macro::mod_pub!(local sftp); yazi_macro::mod_flat!(buffer dir_entry provider read_dir rw_file); diff --git a/yazi-fs/src/provider/sftp/mod.rs b/yazi-fs/src/provider/sftp/mod.rs new file mode 100644 index 00000000..330ec80f --- /dev/null +++ b/yazi-fs/src/provider/sftp/mod.rs @@ -0,0 +1 @@ +yazi_macro::mod_flat!(sftp); diff --git a/yazi-fs/src/provider/sftp/sftp.rs b/yazi-fs/src/provider/sftp/sftp.rs new file mode 100644 index 00000000..6732e35a --- /dev/null +++ b/yazi-fs/src/provider/sftp/sftp.rs @@ -0,0 +1,190 @@ +use std::{io, path::{Path, PathBuf}}; + +use crate::cha::Cha; + +pub struct Sftp; + +impl Sftp { + pub fn cache

(_: P) -> Option + where + P: AsRef, + { + todo!() + } + + pub async fn canonicalize

(path: P) -> io::Result + where + P: AsRef, + { + todo!() + } + + pub async fn copy(from: P, to: Q, cha: Cha) -> io::Result + where + P: AsRef, + Q: AsRef, + { + todo!() + } + + pub async fn create

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn create_dir

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn create_dir_all

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn hard_link(original: P, link: Q) -> io::Result<()> + where + P: AsRef, + Q: AsRef, + { + todo!() + } + + pub async fn metadata

(path: P) -> io::Result + where + P: AsRef, + { + todo!() + } + + pub async fn open

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn read

(path: P) -> io::Result> + where + P: AsRef, + { + todo!() + } + + pub async fn read_dir

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub fn read_dir_sync

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn read_link

(path: P) -> io::Result + where + P: AsRef, + { + todo!() + } + + pub async fn read_to_string

(path: P) -> io::Result + where + P: AsRef, + { + todo!() + } + + pub async fn remove_dir

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn remove_dir_all

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn remove_file

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn rename(from: P, to: Q) -> io::Result<()> + where + P: AsRef, + Q: AsRef, + { + todo!() + } + + pub async fn symlink(original: P, link: Q, _is_dir: F) -> io::Result<()> + where + P: AsRef, + Q: AsRef, + F: AsyncFnOnce() -> io::Result, + { + todo!() + } + + pub async fn symlink_dir(original: P, link: Q) -> io::Result<()> + where + P: AsRef, + Q: AsRef, + { + todo!() + } + + pub async fn symlink_file(original: P, link: Q) -> io::Result<()> + where + P: AsRef, + Q: AsRef, + { + todo!() + } + + pub async fn symlink_metadata

(path: P) -> io::Result + where + P: AsRef, + { + todo!() + } + + pub fn symlink_metadata_sync

(path: P) -> io::Result + where + P: AsRef, + { + todo!() + } + + pub async fn trash

(path: P) -> io::Result<()> + where + P: AsRef, + { + todo!() + } + + pub async fn write(path: P, contents: C) -> io::Result<()> + where + P: AsRef, + C: AsRef<[u8]>, + { + todo!() + } +} diff --git a/yazi-sftp/README.md b/yazi-sftp/README.md index d40462f4..df360679 100644 --- a/yazi-sftp/README.md +++ b/yazi-sftp/README.md @@ -1,4 +1,4 @@ -## yazi-sftp +# yazi-sftp A fork of [`russh-sftp`](https://github.com/AspectUnk/russh-sftp) used by Yazi, with some changes: @@ -6,7 +6,7 @@ A fork of [`russh-sftp`](https://github.com/AspectUnk/russh-sftp) used by Yazi, - Supports retrieving file nlink, username, and group - Uses generic return parameters for a more idiomatic API, e.g.: ```rust - let attrs: responses::Attrs = session.send(requests::Stat::new(path)).await?; + let attrs: responses::Attrs = session.send(requests::Stat::new(path)).await? ``` - Reduced dependencies - Performance optimizations: