From c3516341cb6df421d40aaccde93faf93a0e93de1 Mon Sep 17 00:00:00 2001 From: Chip Senkbeil Date: Sun, 3 Oct 2021 00:33:59 -0500 Subject: [PATCH] Apply renames from code review (needs full refactoring) Co-authored-by: Wez Furlong --- wezterm-ssh/src/session.rs | 2 +- wezterm-ssh/src/session/sftp.rs | 22 +++++++++++----------- wezterm-ssh/src/session/sftp/file.rs | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/wezterm-ssh/src/session.rs b/wezterm-ssh/src/session.rs index 7129d9e13..1006dd74e 100644 --- a/wezterm-ssh/src/session.rs +++ b/wezterm-ssh/src/session.rs @@ -619,7 +619,7 @@ impl SessionInner { /// Open a handle to a file. /// /// See [`Sftp::open_mode`] for more information. - pub fn open_mode( + pub fn open_with_mode( &mut self, sess: &ssh2::Session, open_mode: &sftp::OpenMode, diff --git a/wezterm-ssh/src/session/sftp.rs b/wezterm-ssh/src/session/sftp.rs index 85037553e..d5e8d58d3 100644 --- a/wezterm-ssh/src/session/sftp.rs +++ b/wezterm-ssh/src/session/sftp.rs @@ -50,7 +50,7 @@ impl Sftp { /// Open a handle to a file. /// /// See [`Sftp::open_mode`] for more information. - pub async fn open_mode( + pub async fn open_with_mode( &self, filename: impl Into, opts: OpenOptions, @@ -104,7 +104,7 @@ impl Sftp { /// Helper to open a directory for reading its contents. /// /// See [`Sftp::opendir`] for more information. - pub async fn opendir(&self, filename: impl Into) -> SftpChannelResult { + pub async fn open_dir(&self, filename: impl Into) -> SftpChannelResult { let (reply, rx) = bounded(1); self.tx .send(SessionRequest::Sftp(SftpRequest::Opendir(Opendir { @@ -123,7 +123,7 @@ impl Sftp { /// filtered out of the returned list. /// /// See [`Sftp::readdir`] for more information. - pub async fn readdir( + pub async fn read_dir( &self, filename: impl Into, ) -> SftpChannelResult> { @@ -141,7 +141,7 @@ impl Sftp { /// Create a directory on the remote filesystem. /// /// See [`Sftp::rmdir`] for more information. - pub async fn mkdir(&self, filename: impl Into, mode: i32) -> SftpChannelResult<()> { + pub async fn create_dir(&self, filename: impl Into, mode: i32) -> SftpChannelResult<()> { let (reply, rx) = bounded(1); self.tx .send(SessionRequest::Sftp(SftpRequest::Mkdir(Mkdir { @@ -157,7 +157,7 @@ impl Sftp { /// Remove a directory from the remote filesystem. /// /// See [`Sftp::rmdir`] for more information. - pub async fn rmdir(&self, filename: impl Into) -> SftpChannelResult<()> { + pub async fn remove_dir(&self, filename: impl Into) -> SftpChannelResult<()> { let (reply, rx) = bounded(1); self.tx .send(SessionRequest::Sftp(SftpRequest::Rmdir(Rmdir { @@ -172,7 +172,7 @@ impl Sftp { /// Get the metadata for a file, performed by stat(2). /// /// See [`Sftp::stat`] for more information. - pub async fn stat(&self, filename: impl Into) -> SftpChannelResult { + pub async fn metadata(&self, filename: impl Into) -> SftpChannelResult { let (reply, rx) = bounded(1); self.tx .send(SessionRequest::Sftp(SftpRequest::Stat(Stat { @@ -187,7 +187,7 @@ impl Sftp { /// Get the metadata for a file, performed by lstat(2). /// /// See [`Sftp::lstat`] for more information. - pub async fn lstat(&self, filename: impl Into) -> SftpChannelResult { + pub async fn symlink_metadata(&self, filename: impl Into) -> SftpChannelResult { let (reply, rx) = bounded(1); self.tx .send(SessionRequest::Sftp(SftpRequest::Lstat(Lstat { @@ -202,7 +202,7 @@ impl Sftp { /// Set the metadata for a file. /// /// See [`Sftp::setstat`] for more information. - pub async fn setstat( + pub async fn set_metadata( &self, filename: impl Into, metadata: Metadata, @@ -242,7 +242,7 @@ impl Sftp { /// Read a symlink at `path`. /// /// See [`Sftp::readlink`] for more information. - pub async fn readlink(&self, path: impl Into) -> SftpChannelResult { + pub async fn read_link(&self, path: impl Into) -> SftpChannelResult { let (reply, rx) = bounded(1); self.tx .send(SessionRequest::Sftp(SftpRequest::Readlink(Readlink { @@ -257,7 +257,7 @@ impl Sftp { /// Resolve the real path for `path`. /// /// See [`Sftp::realpath`] for more information. - pub async fn realpath(&self, path: impl Into) -> SftpChannelResult { + pub async fn canonicalize(&self, path: impl Into) -> SftpChannelResult { let (reply, rx) = bounded(1); self.tx .send(SessionRequest::Sftp(SftpRequest::Realpath(Realpath { @@ -294,7 +294,7 @@ impl Sftp { /// Remove a file on the remote filesystem. /// /// See [`Sftp::unlink`] for more information. - pub async fn unlink(&self, file: impl Into) -> SftpChannelResult<()> { + pub async fn remove_file(&self, file: impl Into) -> SftpChannelResult<()> { let (reply, rx) = bounded(1); self.tx .send(SessionRequest::Sftp(SftpRequest::Unlink(Unlink { diff --git a/wezterm-ssh/src/session/sftp/file.rs b/wezterm-ssh/src/session/sftp/file.rs index 5b0b67940..b9d88d711 100644 --- a/wezterm-ssh/src/session/sftp/file.rs +++ b/wezterm-ssh/src/session/sftp/file.rs @@ -123,7 +123,7 @@ impl File { /// Set the metadata for this handle. /// /// See [`ssh2::File::setstat`] for more information. - pub async fn setstat(&self, metadata: Metadata) -> SftpChannelResult<()> { + pub async fn set_metadata(&self, metadata: Metadata) -> SftpChannelResult<()> { let (reply, rx) = bounded(1); self.tx .as_ref() @@ -143,7 +143,7 @@ impl File { /// Get the metadata for this handle. /// /// See [`ssh2::File::stat`] for more information. - pub async fn stat(&self) -> SftpChannelResult { + pub async fn metadata(&self) -> SftpChannelResult { let (reply, rx) = bounded(1); self.tx .as_ref() @@ -170,7 +170,7 @@ impl File { /// files in this directory. /// /// See [`ssh2::File::readdir`] for more information. - pub async fn readdir(&self) -> anyhow::Result<(PathBuf, Metadata)> { + pub async fn read_dir(&self) -> anyhow::Result<(PathBuf, Metadata)> { let (reply, rx) = bounded(1); self.tx .as_ref()