refactored

This commit is contained in:
Andreas Fitzek 2017-12-18 14:31:07 +01:00
parent ee124671d8
commit 3ed319872a
No known key found for this signature in database
GPG Key ID: 8744E5BBA4D08FAF
4 changed files with 19 additions and 13 deletions

View File

@ -820,7 +820,7 @@ ssh gateway port
increase verbosity
#### --host, -H
#### --host, -s
access host OS (for devices with Resin OS >= 2.7.5)

View File

@ -98,3 +98,9 @@ exports.advancedConfig =
description: 'show advanced configuration options'
boolean: true
alias: 'v'
exports.hostOSAccess =
signature: 'host'
boolean: true
description: 'access host OS (for devices with Resin OS >= 2.7.5)'
alias: 's'

View File

@ -14,6 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
###
{ hostOSAccess } = require('../command-options')
_ = require('lodash')
localHostOSAccessOption = _.cloneDeep(hostOSAccess)
localHostOSAccessOption.description = 'get a shell into the host OS'
module.exports =
signature: 'local ssh [deviceIp]'
description: 'Get a shell into a resinOS device'
@ -43,11 +49,7 @@ module.exports =
description: 'increase verbosity'
alias: 'v'
,
signature: 'host'
boolean: true
description: 'get a shell into the host OS'
alias: 's'
,
localHostOSAccessOption,
signature: 'container'
parameter: 'container'
default: null

View File

@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
###
commandOptions = require('./command-options')
module.exports =
signature: 'ssh [uuid]'
description: '(beta) get a shell into the running app container of a device'
@ -45,12 +47,7 @@ module.exports =
boolean: true
description: 'increase verbosity'
alias: 'v'
,
signature: 'host'
boolean: true
description: 'access host OS (for devices with Resin OS >= 2.7.5)'
alias: 'H'
,
commandOptions.hostOSAccess,
signature: 'noproxy'
boolean: true
description: "don't use the proxy configuration for this connection.
@ -124,9 +121,10 @@ module.exports =
Promise.try ->
sshProxyCommand = getSshProxyCommand(hasTunnelBin)
accessCommand = "enter #{uuid} #{containerId}"
if options.host
accessCommand = "host #{uuid}"
else
accessCommand = "enter #{uuid} #{containerId}"
command = "ssh #{verbose} -t \
-o LogLevel=ERROR \