-
-
Save Licenser/a6e903ef4c7998d82d34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn do-sftp-fn | |
[sftp commands] | |
(map (fn [command] | |
(let | |
[cmd_is? (partial = (first command)) | |
opts (next command) | |
_ (println "cmd " command) ] | |
(cond | |
(cmd_is? :put) (do | |
(println (str "put " (first opts) " " (second opts) ".")) | |
(.put sftp (first opts) (second opts))) | |
(cmd_is? :get) (do | |
(println (str "get " (first opts) " " (second opts) ".")) | |
(.get sftp (first opts) (second opts))) | |
))) commands)) | |
(defmacro do-sftp | |
[& commands] | |
`(let | |
[sftp# (.openChannel ~'session "sftp")] | |
(.connect sftp#) | |
(do-sftp-fn sftp# '~commands) | |
(println-str '~commands) | |
(.disconnect sftp#))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment