|
1 | 1 | (ns #^{:author "Hugo Duncan"}
|
2 | 2 | clj-ssh.ssh
|
3 |
| - "SSH in clojure. Uses jsch. Provides a ssh function that tries to look similar |
4 |
| -to clojure.contrib.shell/sh. |
| 3 | + "SSH in clojure. Uses jsch. Provides a ssh function that tries to look |
| 4 | +similar to clojure.contrib.shell/sh. |
5 | 5 |
|
6 | 6 | ## Usage
|
7 | 7 |
|
@@ -38,13 +38,13 @@ Leiningen (http://github.com/technomancy/leiningen).
|
38 | 38 |
|
39 | 39 | Licensed under EPL (http://www.eclipse.org/legal/epl-v10.html)"
|
40 | 40 | (:use
|
41 |
| - [clojure.contrib.def :only [defvar defunbound]]) |
| 41 | + [clojure.contrib.def :only [defvar defvar- defunbound]]) |
42 | 42 | (:require
|
43 | 43 | clj-ssh.keychain
|
44 | 44 | [clojure.contrib.logging :as logging])
|
45 | 45 | (:import [com.jcraft.jsch
|
46 | 46 | JSch Session Channel ChannelShell ChannelExec ChannelSftp
|
47 |
| - Identity IdentityFile Logger])) |
| 47 | + Identity IdentityFile Logger KeyPair])) |
48 | 48 |
|
49 | 49 | ;; working towards clojure 1.1/1.2 compat
|
50 | 50 | (try
|
@@ -215,8 +215,9 @@ Licensed under EPL (http://www.eclipse.org/legal/epl-v10.html)"
|
215 | 215 |
|
216 | 216 | (defmacro with-ssh-agent
|
217 | 217 | "Bind an ssh-agent for use as identity manager.
|
218 |
| -The argument vector can be empty, in which case a new agent is created. If passed a String or File, then this is passed to the new agent as an identity to be added. |
219 |
| -An existing agent instance can alternatively be passed." |
| 218 | +The argument vector can be empty, in which case a new agent is created. If |
| 219 | +passed a String or File, then this is passed to the new agent as an identity to |
| 220 | +be added. An existing agent instance can alternatively be passed." |
220 | 221 | [[& agent] & body]
|
221 | 222 | `(binding [*ssh-agent*
|
222 | 223 | ~(if (seq agent)
|
@@ -465,8 +466,11 @@ Options are
|
465 | 466 | 1 (. target# (~name (first args#)))
|
466 | 467 | 2 (. target# (~name (first args#) (second args#)))
|
467 | 468 | 3 (. target# (~name (first args#) (second args#) (nth args# 2)))
|
468 |
| - 4 (. target# (~name (first args#) (second args#) (nth args# 2) (nth args# 3))) |
469 |
| - 5 (. target# (~name (first args#) (second args#) (nth args# 2) (nth args# 3) (nth args# 4))) |
| 469 | + 4 (. target# |
| 470 | + (~name (first args#) (second args#) (nth args# 2) (nth args# 3))) |
| 471 | + 5 (. target# |
| 472 | + (~name (first args#) (second args#) (nth args# 2) (nth args# 3) |
| 473 | + (nth args# 4))) |
470 | 474 | (throw
|
471 | 475 | (java.lang.IllegalArgumentException.
|
472 | 476 | (str
|
@@ -545,8 +549,10 @@ Options are
|
545 | 549 | "
|
546 | 550 | [session-or-hostname cmd & args]
|
547 | 551 | (let [opts (parse-args args)
|
548 |
| - channel-given (instance? com.jcraft.jsch.ChannelSftp session-or-hostname) |
549 |
| - session-given (instance? com.jcraft.jsch.Session session-or-hostname) |
| 552 | + channel-given (instance? |
| 553 | + com.jcraft.jsch.ChannelSftp session-or-hostname) |
| 554 | + session-given (instance? |
| 555 | + com.jcraft.jsch.Session session-or-hostname) |
550 | 556 | session (if session-given
|
551 | 557 | session-or-hostname
|
552 | 558 | (if channel-given
|
|
0 commit comments