simple-ssh
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -9,7 +9,9 @@ 'use strict'; | ||
* @param {Object} config | ||
* @param {String} config.host - Host to connect to | ||
* @param {Number} [config.port=22] - Port number | ||
* @param {String} config.user - Username | ||
* @param {String} config.pass - Password | ||
* @param {String} [config.baseDir=''] - Base directory to perform commands from | ||
* @param {String} config.host - Host to connect to | ||
* @param {Number} [config.port=22] - Port number | ||
* @param {String} config.user - Username | ||
* @param {String} config.pass - Password | ||
* @param {String} [config.baseDir=''] - Base directory to perform commands from | ||
* @param {String} [config.agent=''] - SSH Agent to connect with | ||
* @param {String} [config.agentForward=''] - Use agent forwarding | ||
* @constructor | ||
@@ -25,3 +27,5 @@ */ | ||
key: '', | ||
baseDir: '' | ||
baseDir: '', | ||
agent: '', | ||
agentForward: '' | ||
}, config); | ||
@@ -32,9 +36,11 @@ | ||
this.host = config.host; | ||
this.port = config.port; | ||
this.user = config.user; | ||
this.pass = config.pass; | ||
this.timeout = config.timeout; | ||
this.key = config.key; | ||
this.baseDir = config.baseDir; | ||
this.host = config.host; | ||
this.port = config.port; | ||
this.user = config.user; | ||
this.pass = config.pass; | ||
this.timeout = config.timeout; | ||
this.key = config.key; | ||
this.baseDir = config.baseDir; | ||
this.agent = config.agent; | ||
this.agentForward = config.agentForward; | ||
}; | ||
@@ -206,2 +212,11 @@ | ||
}); | ||
} else { | ||
self._c.connect({ | ||
host: self.host, | ||
port: self.port || 22, | ||
username: self.user, | ||
agent: self.agent, | ||
agentForward: self.agentForward, | ||
readyTimeout: self.timeout | ||
}); | ||
} | ||
@@ -208,0 +223,0 @@ }; |
{ | ||
"name": "simple-ssh", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "A wrapper for ssh2 to make it easier to perform commands over SSH", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -41,2 +41,13 @@ # simple-ssh | ||
* Connecting with the active SSH Agent with Agent Forwarding | ||
```javascript | ||
var ssh = new ssh({ | ||
host: 'localhost', | ||
user: 'username', | ||
agent: process.env.SSH_AUTH_SOCK, | ||
agentForward: true | ||
}) | ||
``` | ||
* Capturing error output: | ||
@@ -159,2 +170,7 @@ | ||
* **config.pass** { _String_ }: Password | ||
* **config.timeout** { _Number_ }: Connection timeout in milliseconds (default: `10000`) | ||
* **config.key** { _String_ }: SSH key | ||
* **config.baseDir** { _String_ }: Base directory. If this is set, each command will be preceeded by `cd ${this.baseDir}` | ||
* **config.agent** { _String_ }: Connects with the given SSH agent. If this is set, no need to specify a private key or password. | ||
* **config.agentForward** { _Boolean_ }: Set to true to connect with agent forwarding. | ||
* **exec**( _command_, [ _options_ ] ): **Adds a command to the stack** | ||
@@ -185,3 +201,13 @@ * **command** { _String_ }: Command to be executed | ||
* **end**(): **Ends the SSH session** (this is automatically called at the end of a command queue). | ||
### Properties | ||
* **host** { _String_ }: Host to connect to | ||
* **port** { _Number_ }: Port to connect through (default: `22`) | ||
* **user** { _String_ }: User name | ||
* **pass** { _String_ }: Password | ||
* **timeout** { _Number_ }: Connection timeout in milliseconds (default: `10000`) | ||
* **key** { _String_ }: SSH key | ||
* **baseDir** { _String_ }: If set, will change directory to `baseDir` before each command | ||
### Flow Control | ||
@@ -188,0 +214,0 @@ |
26744
519
254