emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ssh-deploy 560ff1d 037/173: Added TRAMP functions and i


From: Stefan Monnier
Subject: [elpa] externals/ssh-deploy 560ff1d 037/173: Added TRAMP functions and improved messages.
Date: Sat, 20 Oct 2018 10:36:26 -0400 (EDT)

branch: externals/ssh-deploy
commit 560ff1dc22db3abb505ee72ffd681926d6d619c9
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Added TRAMP functions and improved messages.
---
 ssh-deploy.el | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/ssh-deploy.el b/ssh-deploy.el
index 6d1ea00..5f7531f 100644
--- a/ssh-deploy.el
+++ b/ssh-deploy.el
@@ -192,15 +192,16 @@
   "Download REMOTE to LOCAL with the LOCAL-ROOT via ssh or ftp."
   (if (or (string= (alist-get 'protocol remote) "ssh") (string= (alist-get 
'protocol remote) "ftp"))
       (progn
-        (message "Downloading path '%s' to '%s'.." remote local)
-        (let ((file-or-directory (file-regular-p local)))
-          (if file-or-directory
+        (let ((path (concat (alist-get 'server remote) ":" (alist-get 'path 
remote))))
+          (message "Downloading path '%s' to '%s'.." path local)
+          (let ((file-or-directory (file-regular-p local)))
+            (if file-or-directory
+                (if (string= (alist-get 'protocol remote) "ssh")
+                    (ssh-deploy--download-file-via-ssh remote local)
+                  (ssh-deploy--download-file-via-ftp remote local))
               (if (string= (alist-get 'protocol remote) "ssh")
-                  (ssh-deploy--download-file-via-ssh remote local)
-                (ssh-deploy--download-file-via-ftp remote local))
-            (if (string= (alist-get 'protocol remote) "ssh")
-                (ssh-deploy--download-directory-via-ssh remote local 
local-root)
-              (ssh-deploy--download-directory-via-ftp remote local 
local-root)))))
+                  (ssh-deploy--download-directory-via-ssh remote local 
local-root)
+                (ssh-deploy--download-directory-via-ftp remote local 
local-root))))))
     (message "Unsupported protocol. Only SSH and FTP are supported at the 
moment.")))
 
 ;; TODO: Left for further research, is it possible to make this asynchrous?
@@ -216,11 +217,24 @@
         (message "Uploading directory '%s' to '%s' via TRAMP.." local 
remote-path)
         (copy-directory local remote-path t t)))))
 
+;; TODO: Left for further research, is it possible to make this asynchrous?
+(defun ssh-deploy--download-via-tramp (remote local local-root)
+  "Download REMOTE path to LOCAL and LOCAL-ROOT via tramp."
+  (let ((remote-path (concat "/" (alist-get 'protocol remote) ":" 
(shell-quote-argument (alist-get 'username remote)) "@" (shell-quote-argument 
(alist-get 'server remote)) ":" (shell-quote-argument (alist-get 'path 
remote))))
+        (file-or-directory (file-regular-p local)))
+    (if file-or-directory
+        (progn
+          (message "Downloading file '%s' to '%s' via TRAMP.." remote-path 
local)
+          (copy-file remote-path local t t))
+      (progn
+        (message "Download directory '%s' to '%s' via TRAMP.." remote-path 
local)
+        (copy-directory remote-path local t t)))))
+
 (defun ssh-deploy--upload (local remote local-root)
   "Upload LOCAL to REMOTE and LOCAL-ROOT via ssh or ftp."
   (if (or (string= (alist-get 'protocol remote) "ssh") (string= (alist-get 
'protocol remote) "ftp"))
       (progn
-        (let ((path (concat (shell-quote-argument (alist-get 'username 
remote)) "@" (shell-quote-argument (alist-get 'server remote)) ":" 
(shell-quote-argument (alist-get 'path remote)))))
+        (let ((path (concat (alist-get 'server remote) ":" (alist-get 'path 
remote))))
           (message "Uploading path '%s' to '%s'.." local path)
           (let ((file-or-directory (file-regular-p local)))
             (if file-or-directory



reply via email to

[Prev in Thread] Current Thread [Next in Thread]