2014-11-24 16:12:12 +00:00
|
|
|
_ = require('lodash')
|
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-17 19:48:26 +00:00
|
|
|
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.setVersion(packageJSON.version)
|
2014-11-20 16:05:50 +00:00
|
|
|
|
2014-11-21 14:44:48 +00:00
|
|
|
# ---------- Options ----------
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.addOption('-y, --yes', 'confirm non interactively')
|
|
|
|
resin.cli.addOption('-v, --verbose', 'increase verbosity')
|
|
|
|
resin.cli.addOption('-q, --quiet', 'quiet (no output)')
|
|
|
|
resin.cli.addOption('-t, --type <type>', 'specify a type when creating an application')
|
2014-11-21 14:44:48 +00:00
|
|
|
|
2014-11-24 16:12:12 +00:00
|
|
|
# TODO: I have to use 'application' instead of 'app' here
|
|
|
|
# as Commander gets confused with the app command
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.addOption('-a, --application <app>', 'application id', _.parseInt)
|
2014-11-24 16:12:12 +00:00
|
|
|
|
2014-11-18 15:37:29 +00:00
|
|
|
# ---------- Auth Module ----------
|
2014-11-18 15:40:12 +00:00
|
|
|
auth = require('./actions/auth')
|
|
|
|
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.addCommand('login [username:password]', 'login to resin.io', auth.login)
|
|
|
|
resin.cli.addCommand('logout', 'logout from resin.io', auth.logout)
|
|
|
|
resin.cli.addCommand('signup', 'signup to resin.io', auth.signup)
|
2014-11-18 15:37:29 +00:00
|
|
|
|
|
|
|
# ---------- App Module ----------
|
2014-11-18 15:40:12 +00:00
|
|
|
app = require('./actions/app')
|
2014-11-21 13:23:02 +00:00
|
|
|
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.addCommand('app:create <name>', 'create a resin.io application', app.create)
|
|
|
|
resin.cli.addCommand('apps', 'list your applications', app.list)
|
|
|
|
resin.cli.addCommand('app <id>', 'list a single application', app.info)
|
|
|
|
resin.cli.addCommand('app:restart <id>', 'restart an application', app.restart)
|
|
|
|
resin.cli.addCommand('app:rm <id>', 'remove an application', app.remove)
|
2014-11-21 13:43:03 +00:00
|
|
|
|
2014-11-19 17:38:15 +00:00
|
|
|
# ---------- Device Module ----------
|
|
|
|
device = require('./actions/device')
|
2014-11-21 13:23:02 +00:00
|
|
|
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.addCommand('devices <id>', 'show devices for an application', device.list)
|
|
|
|
resin.cli.addCommand('device:rm <id>', 'remove a device', device.remove)
|
|
|
|
resin.cli.addCommand('device:identify <uuid>', 'identify a device with a UUID', device.identify)
|
2014-11-21 18:21:47 +00:00
|
|
|
|
2014-11-19 12:59:17 +00:00
|
|
|
# ---------- Preferences Module ----------
|
|
|
|
preferences = require('./actions/preferences')
|
2014-11-21 13:23:02 +00:00
|
|
|
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.addCommand('preferences', 'open preferences form', preferences.preferences)
|
2014-11-20 16:13:59 +00:00
|
|
|
|
2014-11-20 17:02:29 +00:00
|
|
|
# ---------- Keys Module ----------
|
|
|
|
keys = require('./actions/keys')
|
2014-11-21 13:23:02 +00:00
|
|
|
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.addCommand('keys', 'list all SSH keys', keys.list)
|
|
|
|
resin.cli.addCommand('key <id>', 'list a single SSH key', keys.info)
|
|
|
|
resin.cli.addCommand('key:rm <id>', 'remove a SSH key', keys.remove)
|
2014-11-21 17:56:11 +00:00
|
|
|
|
2014-11-24 16:12:12 +00:00
|
|
|
# ---------- Env Module ----------
|
|
|
|
env = require('./actions/environment-variables')
|
|
|
|
|
2014-11-26 19:05:00 +00:00
|
|
|
resin.cli.addCommand('envs', 'list all environment variables', env.list)
|
|
|
|
resin.cli.addCommand('env:rm <id>', 'remove environment variable', env.remove)
|
2014-11-24 17:00:36 +00:00
|
|
|
|
2014-11-26 17:42:05 +00:00
|
|
|
resin.data.prefix.set resin.config.dataPrefix, (error) ->
|
2014-11-26 18:17:26 +00:00
|
|
|
resin.errors.handle(error) if error?
|
2014-11-26 19:05:00 +00:00
|
|
|
|
|
|
|
resin.cli.parse(process.argv)
|
|
|
|
|
|
|
|
quiet = resin.cli.getArgument('quiet')
|
|
|
|
resin.log.setQuiet(quiet)
|