Implement devices supported command

This commit is contained in:
Juan Cruz Viotti 2014-12-24 12:49:49 -04:00
parent 14f047da53
commit af8d1e4517
3 changed files with 22 additions and 2 deletions

@ -10,6 +10,10 @@ _resin() {
local subcommands="create rm restart" local subcommands="create rm restart"
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) ) COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
return 0 ;; return 0 ;;
devices)
local subcommands="supported"
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
return 0 ;;
device) device)
local subcommands="rename rm identify" local subcommands="rename rm identify"
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) ) COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )

@ -1,4 +1,4 @@
_ = require('lodash') _ = require('lodash-contrib')
async = require('async') async = require('async')
resin = require('../resin') resin = require('../resin')
ui = require('../ui') ui = require('../ui')
@ -72,3 +72,7 @@ exports.rename = permissions.user (params) ->
], (error) -> ], (error) ->
errors.handle(error) if error? errors.handle(error) if error?
exports.supported = permissions.user ->
devices = resin.models.device.getSupportedDeviceTypes()
_.each(devices, _.unary(log.out))

@ -136,7 +136,8 @@ capitano.command
You can specify the application type with the `--type` option. You can specify the application type with the `--type` option.
Otherwise, an interactive dropdown will be shown for you to select from. Otherwise, an interactive dropdown will be shown for you to select from.
TODO: We should support a command to list all supported device types. You can see a list of supported device types with
$ resin devices supported
Examples: Examples:
$ resin app create MyApp $ resin app create MyApp
@ -231,6 +232,17 @@ capitano.command
action: actions.device.list action: actions.device.list
options: [ applicationOption ] options: [ applicationOption ]
capitano.command
signature: 'devices supported'
description: 'list all supported devices'
help: '''
Use this command to get the list of all supported devices
Examples:
$ resin devices supported
'''
action: actions.device.supported
capitano.command capitano.command
signature: 'device rename <id> [name]' signature: 'device rename <id> [name]'
description: 'rename a resin device' description: 'rename a resin device'