mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-25 08:21:04 +00:00
Namespace actions with an actions object
This commit is contained in:
parent
7f01cae064
commit
86ecf5b1b6
7
lib/actions/index.coffee
Normal file
7
lib/actions/index.coffee
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module.exports =
|
||||||
|
app: require('./app')
|
||||||
|
auth: require('./auth')
|
||||||
|
device: require('./device')
|
||||||
|
env: require('./environment-variables')
|
||||||
|
keys: require('./keys')
|
||||||
|
preferences: require('./preferences')
|
@ -1,6 +1,7 @@
|
|||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
resin = require('./resin')
|
resin = require('./resin')
|
||||||
packageJSON = require('../package.json')
|
packageJSON = require('../package.json')
|
||||||
|
actions = require('./actions')
|
||||||
|
|
||||||
resin.cli.setVersion(packageJSON.version)
|
resin.cli.setVersion(packageJSON.version)
|
||||||
|
|
||||||
@ -15,45 +16,33 @@ resin.cli.addOption('-t, --type <type>', 'specify a type when creating an applic
|
|||||||
resin.cli.addOption('-a, --application <app>', 'application id', _.parseInt)
|
resin.cli.addOption('-a, --application <app>', 'application id', _.parseInt)
|
||||||
|
|
||||||
# ---------- Auth Module ----------
|
# ---------- Auth Module ----------
|
||||||
auth = require('./actions/auth')
|
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('login [username:password]', 'login to resin.io', auth.login)
|
resin.cli.addCommand('signup', 'signup to resin.io', actions.auth.signup)
|
||||||
resin.cli.addCommand('logout', 'logout from resin.io', auth.logout)
|
|
||||||
resin.cli.addCommand('signup', 'signup to resin.io', auth.signup)
|
|
||||||
|
|
||||||
# ---------- App Module ----------
|
# ---------- App Module ----------
|
||||||
app = require('./actions/app')
|
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:create <name>', 'create a resin.io application', app.create)
|
resin.cli.addCommand('app <id>', 'list a single application', actions.app.info)
|
||||||
resin.cli.addCommand('apps', 'list your applications', app.list)
|
resin.cli.addCommand('app:restart <id>', 'restart an application', actions.app.restart)
|
||||||
resin.cli.addCommand('app <id>', 'list a single application', app.info)
|
resin.cli.addCommand('app:rm <id>', 'remove an application', actions.app.remove)
|
||||||
resin.cli.addCommand('app:restart <id>', 'restart an application', app.restart)
|
|
||||||
resin.cli.addCommand('app:rm <id>', 'remove an application', app.remove)
|
|
||||||
|
|
||||||
# ---------- Device Module ----------
|
# ---------- Device Module ----------
|
||||||
device = require('./actions/device')
|
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('devices <id>', 'show devices for an application', device.list)
|
resin.cli.addCommand('device:identify <uuid>', 'identify a device with a UUID', actions.device.identify)
|
||||||
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)
|
|
||||||
|
|
||||||
# ---------- Preferences Module ----------
|
# ---------- Preferences Module ----------
|
||||||
preferences = require('./actions/preferences')
|
resin.cli.addCommand('preferences', 'open preferences form', actions.preferences.preferences)
|
||||||
|
|
||||||
resin.cli.addCommand('preferences', 'open preferences form', preferences.preferences)
|
|
||||||
|
|
||||||
# ---------- Keys Module ----------
|
# ---------- Keys Module ----------
|
||||||
keys = require('./actions/keys')
|
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('keys', 'list all SSH keys', keys.list)
|
resin.cli.addCommand('key:rm <id>', 'remove a SSH key', actions.keys.remove)
|
||||||
resin.cli.addCommand('key <id>', 'list a single SSH key', keys.info)
|
|
||||||
resin.cli.addCommand('key:rm <id>', 'remove a SSH key', keys.remove)
|
|
||||||
|
|
||||||
# ---------- Env Module ----------
|
# ---------- Env Module ----------
|
||||||
env = require('./actions/environment-variables')
|
resin.cli.addCommand('envs', 'list all environment variables', actions.env.list)
|
||||||
|
resin.cli.addCommand('env:rm <id>', 'remove environment variable', actions.env.remove)
|
||||||
resin.cli.addCommand('envs', 'list all environment variables', env.list)
|
|
||||||
resin.cli.addCommand('env:rm <id>', 'remove environment variable', env.remove)
|
|
||||||
|
|
||||||
resin.data.prefix.set resin.config.dataPrefix, (error) ->
|
resin.data.prefix.set resin.config.dataPrefix, (error) ->
|
||||||
resin.errors.handle(error) if error?
|
resin.errors.handle(error) if error?
|
||||||
|
Loading…
Reference in New Issue
Block a user