balena-cli/lib/app.coffee

54 lines
2.4 KiB
CoffeeScript
Raw Normal View History

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')
actions = require('./actions')
2014-11-17 19:48:26 +00:00
resin.cli.setVersion(packageJSON.version)
2014-11-20 16:05:50 +00:00
# ---------- Options ----------
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-24 16:12:12 +00:00
# TODO: I have to use 'application' instead of 'app' here
# as Commander gets confused with the app command
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 ----------
resin.cli.addCommand('login [username:password]', 'login to resin.io', actions.auth.login)
resin.cli.addCommand('logout', 'logout from resin.io', actions.auth.logout)
resin.cli.addCommand('signup', 'signup to resin.io', actions.auth.signup)
2014-11-18 15:37:29 +00:00
# ---------- App Module ----------
resin.cli.addCommand('app:create <name>', 'create a resin.io application', actions.app.create)
resin.cli.addCommand('apps', 'list your applications', actions.app.list)
resin.cli.addCommand('app <id>', 'list a single application', actions.app.info)
resin.cli.addCommand('app:restart <id>', 'restart an application', actions.app.restart)
resin.cli.addCommand('app:rm <id>', 'remove an application', actions.app.remove)
2014-11-21 13:43:03 +00:00
2014-11-19 17:38:15 +00:00
# ---------- Device Module ----------
resin.cli.addCommand('devices <id>', 'show devices for an application', actions.device.list)
resin.cli.addCommand('device:rm <id>', 'remove a device', actions.device.remove)
resin.cli.addCommand('device:identify <uuid>', 'identify a device with a UUID', actions.device.identify)
2014-11-21 18:21:47 +00:00
2014-11-19 12:59:17 +00:00
# ---------- Preferences Module ----------
resin.cli.addCommand('preferences', 'open preferences form', actions.preferences.preferences)
2014-11-20 16:13:59 +00:00
2014-11-20 17:02:29 +00:00
# ---------- Keys Module ----------
resin.cli.addCommand('keys', 'list all SSH keys', actions.keys.list)
resin.cli.addCommand('key <id>', 'list a single SSH key', actions.keys.info)
resin.cli.addCommand('key:rm <id>', 'remove a SSH key', actions.keys.remove)
2014-11-21 17:56:11 +00:00
2014-11-24 16:12:12 +00:00
# ---------- Env Module ----------
resin.cli.addCommand('envs', 'list all environment variables', actions.env.list)
resin.cli.addCommand('env:rm <id>', 'remove environment variable', actions.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?
resin.cli.parse(process.argv)
quiet = resin.cli.getArgument('quiet')
resin.log.setQuiet(quiet)