2014-11-24 16:12:12 +00:00
|
|
|
_ = require('lodash')
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano = require('capitano')
|
2014-11-26 16:38:02 +00:00
|
|
|
resin = require('./resin')
|
2014-11-21 13:23:02 +00:00
|
|
|
packageJSON = require('../package.json')
|
2014-11-26 19:11:34 +00:00
|
|
|
actions = require('./actions')
|
2014-12-22 16:47:12 +00:00
|
|
|
log = require('./log/log')
|
2014-12-22 19:28:11 +00:00
|
|
|
errors = require('./errors/errors')
|
2014-11-17 19:48:26 +00:00
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'version'
|
|
|
|
description: 'output the version number'
|
|
|
|
action: ->
|
2014-12-22 16:47:12 +00:00
|
|
|
log.out(packageJSON.version)
|
2014-11-20 16:05:50 +00:00
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'help [command...]'
|
|
|
|
description: 'show help'
|
|
|
|
action: (params) ->
|
|
|
|
if params.command?
|
|
|
|
actions.help.command(params)
|
|
|
|
else
|
|
|
|
actions.help.general()
|
2014-11-27 13:28:24 +00:00
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: '*'
|
|
|
|
action: ->
|
|
|
|
capitano.execute(command: 'help')
|
2014-11-27 13:28:24 +00:00
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
# ---------- Options ----------
|
|
|
|
capitano.globalOption
|
|
|
|
signature: 'quiet'
|
2014-11-27 13:28:24 +00:00
|
|
|
description: 'quiet (no output)'
|
2014-12-12 21:20:29 +00:00
|
|
|
boolean: true
|
|
|
|
alias: 'q'
|
2014-11-27 13:28:24 +00:00
|
|
|
|
2014-12-22 14:08:12 +00:00
|
|
|
capitano.globalOption
|
|
|
|
signature: 'project'
|
|
|
|
parameter: 'path'
|
|
|
|
description: 'project path'
|
|
|
|
alias: 'p'
|
|
|
|
|
2014-12-23 13:21:11 +00:00
|
|
|
# We don't do anything in response to this options
|
|
|
|
# explicitly. We use InquirerJS to provide CLI widgets,
|
|
|
|
# and that module understands --no-color automatically.
|
|
|
|
capitano.globalOption
|
|
|
|
signature: 'no-color'
|
|
|
|
description: 'disable colour highlighting'
|
|
|
|
boolean: true
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
yesOption =
|
|
|
|
signature: 'yes'
|
|
|
|
description: 'confirm non interactively'
|
|
|
|
boolean: true
|
|
|
|
alias: 'y'
|
2014-12-02 15:53:34 +00:00
|
|
|
|
2014-12-19 18:07:53 +00:00
|
|
|
applicationOption =
|
|
|
|
signature: 'application'
|
|
|
|
parameter: 'application'
|
|
|
|
description: 'application id'
|
|
|
|
alias: [ 'a', 'app' ]
|
|
|
|
|
2014-11-18 15:37:29 +00:00
|
|
|
# ---------- Auth Module ----------
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'login [credentials]'
|
2014-11-27 13:28:24 +00:00
|
|
|
description: 'login to resin.io'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to login to your resin.io account.
|
|
|
|
You need to login before you can use most of the commands this tool provides.
|
|
|
|
|
|
|
|
You can pass your credentials as a colon separated string, or you can omit the
|
|
|
|
credentials, in which case the tool will present you with an interactive login form.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin login username:password
|
|
|
|
$ resin login
|
|
|
|
'''
|
2014-11-27 13:28:24 +00:00
|
|
|
action: actions.auth.login
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'logout'
|
2014-11-27 13:28:24 +00:00
|
|
|
description: 'logout from resin.io'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to logout from your resin.io account.o
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin logout
|
|
|
|
'''
|
2014-11-27 13:28:24 +00:00
|
|
|
action: actions.auth.logout
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'signup'
|
2014-11-27 13:28:24 +00:00
|
|
|
description: 'signup to resin.io'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to signup for a resin.io account.
|
|
|
|
|
2014-12-24 15:14:30 +00:00
|
|
|
If signup is successful, you'll be logged in to your new user automatically.
|
|
|
|
|
|
|
|
TODO: We need to provide a non interactive way to use this command,
|
|
|
|
however it's not clear to me how to do it easily for now.
|
2014-12-12 21:20:29 +00:00
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin signup
|
2014-12-24 15:14:30 +00:00
|
|
|
Email: me@mycompany.com
|
|
|
|
Username: johndoe
|
|
|
|
Password: ***********
|
|
|
|
|
|
|
|
$ resin whoami
|
|
|
|
johndoe
|
2014-12-12 21:20:29 +00:00
|
|
|
'''
|
2014-11-27 13:28:24 +00:00
|
|
|
action: actions.auth.signup
|
2014-11-18 15:37:29 +00:00
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'whoami'
|
2014-12-12 14:25:32 +00:00
|
|
|
description: 'get current username'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to find out the current logged in username.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin whoami
|
|
|
|
'''
|
2014-12-12 14:25:32 +00:00
|
|
|
action: actions.auth.whoami
|
|
|
|
|
2014-11-18 15:37:29 +00:00
|
|
|
# ---------- App Module ----------
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'app create <name>'
|
|
|
|
description: 'create an application'
|
|
|
|
help: '''
|
|
|
|
Use this command to create a new resin.io application.
|
|
|
|
|
|
|
|
You can specify the application type with the `--type` option.
|
|
|
|
Otherwise, an interactive dropdown will be shown for you to select from.
|
|
|
|
|
|
|
|
TODO: We should support a command to list all supported device types.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin app create MyApp
|
|
|
|
$ resin app create MyApp --type raspberry-pi
|
|
|
|
'''
|
|
|
|
action: actions.app.create
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
signature: 'type'
|
|
|
|
parameter: 'type'
|
|
|
|
description: 'application type'
|
|
|
|
alias: 't'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
capitano.command
|
|
|
|
signature: 'apps'
|
|
|
|
description: 'list all applications'
|
|
|
|
help: '''
|
|
|
|
Use this command to list all your applications.
|
|
|
|
|
|
|
|
Notice this command only shows the most important bits of information for each app.
|
|
|
|
If you want detailed information, use resin app <id> instead.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin apps
|
|
|
|
'''
|
|
|
|
action: actions.app.list
|
|
|
|
|
|
|
|
capitano.command
|
|
|
|
signature: 'app <id>'
|
|
|
|
description: 'list a single application'
|
|
|
|
help: '''
|
|
|
|
Use this command to show detailed information for a single application.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin app 91
|
|
|
|
'''
|
|
|
|
action: actions.app.info
|
|
|
|
|
|
|
|
capitano.command
|
|
|
|
signature: 'app rm <id>'
|
|
|
|
description: 'remove an application'
|
|
|
|
help: '''
|
|
|
|
Use this command to remove a resin.io application.
|
|
|
|
|
|
|
|
Notice this command asks for confirmation interactively.
|
|
|
|
You can avoid this by passing the `--yes` boolean option.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin app rm 91
|
|
|
|
$ resin app rm 91 --yes
|
|
|
|
'''
|
|
|
|
action: actions.app.remove
|
|
|
|
options: [ yesOption ]
|
|
|
|
|
|
|
|
capitano.command
|
|
|
|
signature: 'app restart <id>'
|
2014-11-27 13:28:24 +00:00
|
|
|
description: 'restart an application'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to restart all devices that belongs to a certain application.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin app restart 91
|
|
|
|
'''
|
2014-11-27 13:28:24 +00:00
|
|
|
action: actions.app.restart
|
2014-11-21 13:43:03 +00:00
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'init <id>'
|
2014-12-11 15:31:56 +00:00
|
|
|
description: 'init an application'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to associate a local project to an existing resin.io application.
|
|
|
|
|
|
|
|
The application should be a git repository before issuing this command.
|
|
|
|
Notice this command adds a `resin` git remote to your application.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ cd myApp && resin init 91
|
|
|
|
'''
|
2014-12-11 15:31:56 +00:00
|
|
|
action: actions.app.init
|
|
|
|
|
2014-11-19 17:38:15 +00:00
|
|
|
# ---------- Device Module ----------
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
2014-12-23 12:54:15 +00:00
|
|
|
signature: 'devices'
|
2014-12-12 21:20:29 +00:00
|
|
|
description: 'list all devices'
|
|
|
|
help: '''
|
|
|
|
Use this command to list all devices that belong to a certain application.
|
|
|
|
|
|
|
|
Examples:
|
2014-12-23 12:54:15 +00:00
|
|
|
$ resin devices --application 91
|
2014-12-12 21:20:29 +00:00
|
|
|
'''
|
|
|
|
action: actions.device.list
|
2014-12-23 12:54:15 +00:00
|
|
|
options: [ applicationOption ]
|
2014-12-12 21:20:29 +00:00
|
|
|
|
2014-12-19 14:05:54 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'device rename <id> [name]'
|
|
|
|
description: 'rename a resin device'
|
|
|
|
help: '''
|
|
|
|
Use this command to rename a device.
|
|
|
|
|
|
|
|
If you omit the name, you'll get asked for it interactively.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin device rename 317 MyPi
|
|
|
|
$ resin device rename 317
|
|
|
|
'''
|
|
|
|
action: actions.device.rename
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'device <id>'
|
|
|
|
description: 'list a single device'
|
|
|
|
help: '''
|
|
|
|
Use this command to show information about a single device.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin device 317
|
|
|
|
'''
|
|
|
|
action: actions.device.info
|
|
|
|
|
|
|
|
capitano.command
|
|
|
|
signature: 'device rm <id>'
|
|
|
|
description: 'remove a device'
|
|
|
|
help: '''
|
|
|
|
Use this command to remove a device from resin.io.
|
|
|
|
|
|
|
|
Notice this command asks for confirmation interactively.
|
|
|
|
You can avoid this by passing the `--yes` boolean option.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin device rm 317
|
|
|
|
$ resin device rm 317 --yes
|
|
|
|
'''
|
|
|
|
action: actions.device.remove
|
|
|
|
options: [ yesOption ]
|
|
|
|
|
|
|
|
capitano.command
|
|
|
|
signature: 'device identify <uuid>'
|
2014-11-27 13:28:24 +00:00
|
|
|
description: 'identify a device with a UUID'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to identify a device.
|
|
|
|
|
|
|
|
In the Raspberry Pi, the ACT led is blinked several times.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin device identify 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828
|
|
|
|
'''
|
2014-11-27 13:28:24 +00:00
|
|
|
action: actions.device.identify
|
2014-11-21 18:21:47 +00:00
|
|
|
|
2014-11-19 12:59:17 +00:00
|
|
|
# ---------- Preferences Module ----------
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'preferences'
|
2014-11-27 15:26:59 +00:00
|
|
|
description: 'open preferences form'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to open the preferences form.
|
|
|
|
|
|
|
|
In the future, we will allow changing all preferences directly from the terminal.
|
|
|
|
For now, we open your default web browser and point it to the web based preferences form.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin preferences
|
|
|
|
'''
|
2014-11-27 15:26:59 +00:00
|
|
|
action: actions.preferences.preferences
|
2014-11-20 16:13:59 +00:00
|
|
|
|
2014-11-20 17:02:29 +00:00
|
|
|
# ---------- Keys Module ----------
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'keys'
|
|
|
|
description: 'list all ssh keys'
|
|
|
|
help: '''
|
|
|
|
Use this command to list all your SSH keys.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin keys
|
|
|
|
'''
|
|
|
|
action: actions.keys.list
|
|
|
|
|
2014-12-22 14:30:21 +00:00
|
|
|
# TODO: Write help page for this command
|
2014-12-19 17:06:58 +00:00
|
|
|
capitano.command
|
2014-12-22 14:30:21 +00:00
|
|
|
signature: 'key add <name> [path]'
|
2014-12-19 17:06:58 +00:00
|
|
|
description: 'add a SSH key to resin.io'
|
2014-12-22 14:30:21 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to associate a new SSH key with your account.
|
|
|
|
|
|
|
|
If `path` is omitted, the command will attempt
|
|
|
|
to read the SSH key from stdin.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin key add Main ~/.ssh/id_rsa.pub
|
|
|
|
$ cat ~/.ssh/id_rsa.pub | resin key add Main
|
|
|
|
'''
|
2014-12-19 17:06:58 +00:00
|
|
|
action: actions.keys.add
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'key <id>'
|
|
|
|
description: 'list a single ssh key'
|
|
|
|
help: '''
|
|
|
|
Use this command to show information about a single SSH key.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin key 17
|
|
|
|
'''
|
|
|
|
action: actions.keys.info
|
|
|
|
|
|
|
|
capitano.command
|
|
|
|
signature: 'key rm <id>'
|
|
|
|
description: 'remove a ssh key'
|
|
|
|
help: '''
|
|
|
|
Use this command to remove a SSH key from resin.io.
|
|
|
|
|
|
|
|
Notice this command asks for confirmation interactively.
|
|
|
|
You can avoid this by passing the `--yes` boolean option.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin key rm 17
|
|
|
|
$ resin key rm 17 --yes
|
|
|
|
'''
|
|
|
|
action: actions.keys.remove
|
|
|
|
options: [ yesOption ]
|
2014-11-21 17:56:11 +00:00
|
|
|
|
2014-11-24 16:12:12 +00:00
|
|
|
# ---------- Env Module ----------
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'envs'
|
|
|
|
description: 'list all environment variables'
|
|
|
|
help: '''
|
|
|
|
Use this command to list all environment variables for a particular application.
|
|
|
|
Notice we will support per-device environment variables soon.
|
|
|
|
|
|
|
|
This command lists all custom environment variables set on the devices running
|
|
|
|
the application. If you want to see all environment variables, including private
|
|
|
|
ones used by resin, use the verbose option.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
$ resin envs --application 91
|
|
|
|
$ resin envs --application 91 --verbose
|
|
|
|
'''
|
|
|
|
action: actions.env.list
|
|
|
|
options: [
|
2014-12-19 18:07:53 +00:00
|
|
|
applicationOption
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
{
|
|
|
|
signature: 'verbose'
|
|
|
|
description: 'show private environment variables'
|
|
|
|
boolean: true
|
|
|
|
alias: 'v'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2014-12-19 18:07:53 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'env add <key> [value]'
|
|
|
|
description: 'add an environment variable'
|
|
|
|
help: '''
|
|
|
|
Use this command to add an enviroment variable to an application.
|
|
|
|
|
|
|
|
You need to pass the `--application` option.
|
|
|
|
|
|
|
|
If value is omitted, the tool will attempt to use the variable's value
|
|
|
|
as defined in your host machine.
|
|
|
|
|
|
|
|
If the value is grabbed from the environment, a warning message will be printed.
|
|
|
|
Use `--quiet` to remove it.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin env add EDITOR vim -a 91
|
|
|
|
$ resin env add TERM -a 91
|
|
|
|
'''
|
|
|
|
options: [ applicationOption ]
|
|
|
|
action: actions.env.add
|
|
|
|
|
2014-12-19 18:28:03 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'env rename <id> <value>'
|
|
|
|
description: 'rename an environment variable'
|
|
|
|
help: '''
|
|
|
|
Use this command to rename an enviroment variable from an application.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin env rename 376 emacs
|
|
|
|
'''
|
|
|
|
action: actions.env.rename
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'env rm <id>'
|
|
|
|
description: 'remove an environment variable'
|
|
|
|
help: '''
|
|
|
|
Use this command to remove an environment variable from an application.
|
|
|
|
|
|
|
|
Don't remove resin specific variables, as things might not work as expected.
|
|
|
|
|
|
|
|
Notice this command asks for confirmation interactively.
|
|
|
|
You can avoid this by passing the `--yes` boolean option.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin env rm 215
|
|
|
|
$ resin env rm 215 --yes
|
|
|
|
'''
|
|
|
|
action: actions.env.remove
|
|
|
|
options: [ yesOption ]
|
2014-11-24 17:00:36 +00:00
|
|
|
|
2014-11-28 16:46:24 +00:00
|
|
|
# ---------- Logs Module ----------
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'logs <uuid>'
|
2014-11-28 16:46:24 +00:00
|
|
|
description: 'show device logs'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to show logs for a specific device.
|
|
|
|
|
|
|
|
By default, the command prints all log messages and exit.
|
|
|
|
|
|
|
|
To limit the output to the n last lines, use the `--num` option along with a number.
|
|
|
|
This is similar to doing `resin logs <uuid> | tail -n X`.
|
|
|
|
|
|
|
|
To continuously stream output, and see new logs in real time, use the `--tail` option.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828
|
|
|
|
$ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --num 20
|
|
|
|
$ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --tail
|
|
|
|
'''
|
2014-11-28 16:46:24 +00:00
|
|
|
action: actions.logs.logs
|
2014-12-12 21:20:29 +00:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
signature: 'num'
|
|
|
|
parameter: 'num'
|
|
|
|
description: 'number of lines to display'
|
|
|
|
alias: 'n'
|
|
|
|
}
|
|
|
|
{
|
|
|
|
signature: 'tail'
|
|
|
|
description: 'continuously stream output'
|
|
|
|
boolean: true
|
|
|
|
alias: 't'
|
|
|
|
}
|
|
|
|
]
|
2014-11-28 16:46:24 +00:00
|
|
|
|
2014-12-02 15:08:22 +00:00
|
|
|
# ---------- OS Module ----------
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'os download <id>'
|
2014-12-02 15:08:22 +00:00
|
|
|
description: 'download device OS'
|
2014-12-12 21:20:29 +00:00
|
|
|
help: '''
|
|
|
|
Use this command to download the device OS configured to a specific network.
|
|
|
|
|
|
|
|
Ethernet:
|
|
|
|
You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".
|
|
|
|
|
|
|
|
Wifi:
|
|
|
|
You can setup the device OS to use wifi by setting the `--network` option to "wifi".
|
|
|
|
If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.
|
|
|
|
|
|
|
|
By default, this command saved the downloaded image into a resin specific directory.
|
|
|
|
You can save it to a custom location by specifying the `--output` option.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
$ resin os download 91 --network ethernet
|
|
|
|
$ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123
|
|
|
|
$ resin os download 91 --network ethernet --output ~/MyResinOS.zip
|
|
|
|
'''
|
2014-12-02 15:08:22 +00:00
|
|
|
action: actions.os.download
|
2014-12-12 21:20:29 +00:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
signature: 'network'
|
|
|
|
parameter: 'network'
|
|
|
|
description: 'network type'
|
|
|
|
alias: 'n'
|
|
|
|
}
|
|
|
|
{
|
|
|
|
signature: 'ssid'
|
|
|
|
parameter: 'ssid'
|
|
|
|
description: 'wifi ssid, if network is wifi'
|
|
|
|
alias: 's'
|
|
|
|
}
|
|
|
|
{
|
|
|
|
signature: 'key'
|
|
|
|
parameter: 'key'
|
|
|
|
description: 'wifi key, if network is wifi'
|
|
|
|
alias: 'k'
|
|
|
|
}
|
|
|
|
{
|
|
|
|
signature: 'output'
|
|
|
|
parameter: 'output'
|
|
|
|
description: 'output file'
|
|
|
|
alias: 'o'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2014-12-22 16:00:01 +00:00
|
|
|
# ---------- Examples Module ----------
|
|
|
|
capitano.command
|
|
|
|
signature: 'examples'
|
|
|
|
description: 'list all example applications'
|
|
|
|
help: '''
|
|
|
|
Use this command to list available example applications from resin.io
|
|
|
|
|
|
|
|
Example:
|
|
|
|
$ resin examples
|
|
|
|
'''
|
|
|
|
action: actions.examples.list
|
|
|
|
|
2014-12-22 16:20:08 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'example clone <id>'
|
|
|
|
description: 'clone an example application'
|
|
|
|
help: '''
|
|
|
|
Use this command to clone an example application to the current directory
|
|
|
|
|
|
|
|
This command outputs information about the cloning process.
|
|
|
|
Use `--quiet` to remove that output.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
$ resin example clone 3
|
|
|
|
'''
|
|
|
|
action: actions.examples.clone
|
|
|
|
|
2014-12-22 16:00:01 +00:00
|
|
|
capitano.command
|
|
|
|
signature: 'example <id>'
|
|
|
|
description: 'list a single example application'
|
|
|
|
help: '''
|
|
|
|
Use this command to show information of a single example application
|
|
|
|
|
|
|
|
Example:
|
|
|
|
$ resin example 3
|
|
|
|
'''
|
|
|
|
action: actions.examples.info
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
cli = capitano.parse(process.argv)
|
2014-12-02 15:08:22 +00:00
|
|
|
|
2014-12-22 14:08:12 +00:00
|
|
|
changeProjectDirectory = (directory) ->
|
|
|
|
try
|
|
|
|
process.chdir(directory)
|
|
|
|
catch
|
2014-12-22 19:28:11 +00:00
|
|
|
errors.handle(new Error("Invalid project: #{directory}"))
|
2014-12-22 14:08:12 +00:00
|
|
|
|
2014-12-05 14:53:59 +00:00
|
|
|
resin.data.prefix.set resin.settings.get('dataPrefix'), (error) ->
|
2014-12-22 19:28:11 +00:00
|
|
|
errors.handle(error) if error?
|
2014-11-26 19:05:00 +00:00
|
|
|
|
2014-12-22 16:47:12 +00:00
|
|
|
log.setQuiet(cli.global.quiet)
|
2014-11-26 19:05:00 +00:00
|
|
|
|
2014-12-22 14:08:12 +00:00
|
|
|
if cli.global.project?
|
|
|
|
changeProjectDirectory(cli.global.project)
|
|
|
|
|
2014-12-12 21:20:29 +00:00
|
|
|
capitano.execute(cli)
|