balena-cli/lib/app.coffee

119 lines
2.7 KiB
CoffeeScript
Raw Normal View History

2014-11-24 12:12:12 -04:00
_ = require('lodash')
2014-11-26 12:38:02 -04:00
resin = require('./resin')
2014-11-21 09:23:02 -04:00
packageJSON = require('../package.json')
actions = require('./actions')
pluginLoader = require('./plugin-loader/plugin-loader')
2014-11-17 15:48:26 -04:00
resin.cli.setVersion(packageJSON.version)
2014-11-20 12:05:50 -04:00
# ---------- Options ----------
resin.cli.addOption
option: '-y, --yes'
description: 'confirm non interactively'
resin.cli.addOption
option: '-v, --verbose'
description: 'increase verbosity'
resin.cli.addOption
option: '-q, --quiet'
description: 'quiet (no output)'
resin.cli.addOption
option: '-t, --type <type>'
description: 'specify a type when creating an application'
2014-11-28 20:18:59 -04:00
resin.cli.addOption
option: '-n, --num <num>'
description: 'number of lines to display'
2014-11-28 20:51:03 -04:00
resin.cli.addOption
option: '--tail'
description: 'continuously stream output'
2014-11-24 12:12:12 -04:00
# TODO: I have to use 'application' instead of 'app' here
# as Commander gets confused with the app command
resin.cli.addOption
option: '-a, --application <app>'
description: 'application id'
coerce: _.parseInt
2014-11-24 12:12:12 -04:00
2014-11-18 11:37:29 -04:00
# ---------- Auth Module ----------
resin.cli.addCommand
command: 'login [username:password]'
description: 'login to resin.io'
action: actions.auth.login
resin.cli.addCommand
command: 'logout'
description: 'logout from resin.io'
action: actions.auth.logout
2014-11-27 10:06:11 -04:00
permission: 'user'
resin.cli.addCommand
command: 'signup'
description: 'signup to resin.io'
action: actions.auth.signup
2014-11-18 11:37:29 -04:00
# ---------- App Module ----------
resin.cli.addResource
name: 'app'
displayName: 'application'
actions: actions.app
2014-11-27 10:06:11 -04:00
permission: 'user'
resin.cli.addCommand
command: 'app:restart <id>'
description: 'restart an application'
action: actions.app.restart
2014-11-27 10:06:11 -04:00
permission: 'user'
2014-11-21 09:43:03 -04:00
2014-11-19 13:38:15 -04:00
# ---------- Device Module ----------
resin.cli.addResource
name: 'device'
displayName: 'device'
actions: actions.device
2014-11-27 10:06:11 -04:00
permission: 'user'
resin.cli.addCommand
command: 'device:identify <uuid>'
description: 'identify a device with a UUID'
action: actions.device.identify
2014-11-27 10:06:11 -04:00
permission: 'user'
2014-11-21 14:21:47 -04:00
2014-11-19 08:59:17 -04:00
# ---------- Preferences Module ----------
resin.cli.addCommand
command: 'preferences'
description: 'open preferences form'
action: actions.preferences.preferences
permission: 'user'
2014-11-20 12:13:59 -04:00
2014-11-20 13:02:29 -04:00
# ---------- Keys Module ----------
resin.cli.addResource
name: 'key'
displayName: 'ssh key'
actions: actions.keys
2014-11-27 10:06:11 -04:00
permission: 'user'
2014-11-21 13:56:11 -04:00
2014-11-24 12:12:12 -04:00
# ---------- Env Module ----------
resin.cli.addResource
name: 'env'
displayName: 'environment variable'
actions: actions.env
2014-11-27 10:06:11 -04:00
permission: 'user'
2014-11-24 13:00:36 -04:00
2014-11-28 12:46:24 -04:00
# ---------- Logs Module ----------
resin.cli.addCommand
command: 'logs <uuid>'
description: 'show device logs'
action: actions.logs.logs
permission: 'user'
2014-11-26 13:42:05 -04:00
resin.data.prefix.set resin.config.dataPrefix, (error) ->
2014-11-26 14:17:26 -04:00
resin.errors.handle(error) if error?
resin.cli.parse(process.argv)
quiet = resin.cli.getArgument('quiet')
resin.log.setQuiet(quiet)