diff --git a/build/actions/ssh.js b/build/actions/ssh.js index 4d7da685..30d6c93f 100644 --- a/build/actions/ssh.js +++ b/build/actions/ssh.js @@ -37,7 +37,7 @@ limitations under the License. module.exports = { signature: 'ssh ', description: '(beta) get a shell into the running app container of a device', - help: 'WARNING: If you\'re running Windows, this command only supports `cmd.exe`.\n\nUse this command to get a shell into the running application container of\nyour device.\n\nExamples:\n\n $ resin ssh 7cf02a6\n $ resin ssh 7cf02a6 --port 8080', + help: 'WARNING: If you\'re running Windows, this command only supports `cmd.exe`.\n\nUse this command to get a shell into the running application container of\nyour device.\n\nExamples:\n\n $ resin ssh 7cf02a6\n $ resin ssh 7cf02a6 --port 8080\n $ resin ssh 7cf02a6 -v', permission: 'user', primary: true, options: [ @@ -46,10 +46,15 @@ limitations under the License. parameter: 'port', description: 'ssh gateway port', alias: 't' + }, { + signature: 'verbose', + boolean: true, + description: 'increase verbosity', + alias: 'v' } ], action: function(params, options, done) { - var Promise, child_process, resin, settings; + var Promise, child_process, resin, settings, verbose; child_process = require('child_process'); Promise = require('bluebird'); resin = require('resin-sdk'); @@ -57,6 +62,7 @@ limitations under the License. if (options.port == null) { options.port = 22; } + verbose = options.verbose ? '-vvv' : ''; console.info("Connecting with: " + params.uuid); return Promise.props({ isOnline: resin.models.device.isOnline(params.uuid), @@ -74,7 +80,7 @@ limitations under the License. } return Promise["try"](function() { var command, spawn, subShellCommand; - command = "ssh -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p " + options.port + " " + username + "@ssh." + (settings.get('proxyUrl')) + " enter " + uuid + " " + containerId; + command = "ssh " + verbose + " -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p " + options.port + " " + username + "@ssh." + (settings.get('proxyUrl')) + " enter " + uuid + " " + containerId; subShellCommand = getSubShellCommand(command); return spawn = child_process.spawn(subShellCommand.program, subShellCommand.args, { stdio: 'inherit' diff --git a/lib/actions/ssh.coffee b/lib/actions/ssh.coffee index fe47a305..717befea 100644 --- a/lib/actions/ssh.coffee +++ b/lib/actions/ssh.coffee @@ -48,6 +48,7 @@ module.exports = $ resin ssh 7cf02a6 $ resin ssh 7cf02a6 --port 8080 + $ resin ssh 7cf02a6 -v ''' permission: 'user' primary: true @@ -56,6 +57,11 @@ module.exports = parameter: 'port' description: 'ssh gateway port' alias: 't' + , + signature: 'verbose' + boolean: true + description: 'increase verbosity' + alias: 'v' ] action: (params, options, done) -> child_process = require('child_process') @@ -66,6 +72,8 @@ module.exports = if not options.port? options.port = 22 + verbose = if options.verbose then '-vvv' else '' + console.info("Connecting with: #{params.uuid}") Promise.props @@ -77,7 +85,7 @@ module.exports = throw new Error('Device is not online') if not isOnline throw new Error('Did not find running application container') if not containerId? Promise.try -> - command = "ssh -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ + command = "ssh #{verbose} -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ -p #{options.port} #{username}@ssh.#{settings.get('proxyUrl')} enter #{uuid} #{containerId}" subShellCommand = getSubShellCommand(command)