balena-cli/lib/app.coffee

95 lines
2.2 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
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-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
option: '-a, --application <app>'
description: 'application id'
coerce: _.parseInt
2014-11-24 16:12:12 +00:00
2014-11-18 15:37:29 +00: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
resin.cli.addCommand
command: 'signup'
description: 'signup to resin.io'
action: actions.auth.signup
2014-11-18 15:37:29 +00:00
# ---------- App Module ----------
resin.cli.addResource
name: 'app'
displayName: 'application'
actions: actions.app
resin.cli.addCommand
command: 'app:restart <id>'
description: 'restart an application'
action: actions.app.restart
2014-11-21 13:43:03 +00:00
2014-11-19 17:38:15 +00:00
# ---------- Device Module ----------
resin.cli.addResource
name: 'device'
displayName: 'device'
actions: actions.device
resin.cli.addCommand
command: 'device:identify <uuid>'
description: 'identify a device with a UUID'
action: actions.device.identify
2014-11-21 18:21:47 +00:00
2014-11-19 12:59:17 +00:00
# ---------- Preferences Module ----------
resin.cli.addCommand
command: 'preferences'
description: 'open preferences form'
action: actions.preferences.preferences
2014-11-20 16:13:59 +00:00
2014-11-20 17:02:29 +00:00
# ---------- Keys Module ----------
resin.cli.addResource
name: 'key'
displayName: 'ssh key'
actions: actions.keys
2014-11-21 17:56:11 +00:00
2014-11-24 16:12:12 +00:00
# ---------- Env Module ----------
resin.cli.addResource
name: 'env'
displayName: 'environment variable'
actions: actions.env
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)