balena-cli/lib/app.coffee

109 lines
2.3 KiB
CoffeeScript
Raw Normal View History

2014-11-18 08:35:50 -04:00
data = require('./data/data')
2014-11-21 11:40:37 -04:00
log = require('./log/log')
2014-11-18 08:35:50 -04:00
config = require('./config')
2014-11-21 09:23:02 -04:00
packageJSON = require('../package.json')
2014-11-17 15:48:26 -04:00
2014-11-21 09:23:02 -04:00
program = require('commander')
program.version(packageJSON.version)
2014-11-20 12:05:50 -04:00
# ---------- Options ----------
program.option('-y, --yes', 'Confirm non interactively')
2014-11-21 12:20:37 -04:00
program.option('-q, --quiet', 'quiet (no output)')
2014-11-18 11:37:29 -04:00
# ---------- Auth Module ----------
auth = require('./actions/auth')
2014-11-21 09:23:02 -04:00
program
.command('login [username:password]')
.description('Login to resin.io')
.action(auth.login)
program
.command('logout')
.description('Logout from resin.io')
.action(auth.logout)
program
.command('signup')
.description('Signup to resin.io')
.action(auth.signup)
2014-11-18 11:37:29 -04:00
# ---------- App Module ----------
app = require('./actions/app')
2014-11-21 09:23:02 -04:00
program
.command('apps')
.description('List your applications')
.action(app.list)
program
.command('app <id>')
.description('List a single application')
.action(app.info)
program
.command('app:restart <id>')
.description('Restart an application')
.action(app.restart)
2014-11-19 09:23:40 -04:00
2014-11-21 09:43:03 -04:00
program
.command('app:rm <id>')
.description('Remove an application')
.action(app.remove)
2014-11-19 13:38:15 -04:00
# ---------- Device Module ----------
device = require('./actions/device')
2014-11-21 09:23:02 -04:00
program
.command('devices <id>')
.description('Show devices for an application')
.action(device.list)
2014-11-19 13:38:15 -04:00
2014-11-21 13:23:29 -04:00
program
.command('device:rm <id>')
.description('Remove a device')
.action(device.remove)
2014-11-21 14:21:47 -04:00
program
.command('device:identify <uuid>')
.description('Identify a device with a UUID')
.action(device.identify)
2014-11-19 08:59:17 -04:00
# ---------- Preferences Module ----------
preferences = require('./actions/preferences')
2014-11-21 09:23:02 -04:00
program
.command('preferences')
.description('Open preferences form')
.action(preferences.preferences)
2014-11-19 08:59:17 -04:00
# ---------- Info Module ----------
2014-11-21 09:23:02 -04:00
program
.command('version')
.description('Show version')
.action ->
2014-11-21 11:40:37 -04:00
log.out(packageJSON.version)
2014-11-20 12:13:59 -04:00
2014-11-20 13:02:29 -04:00
# ---------- Keys Module ----------
keys = require('./actions/keys')
2014-11-21 09:23:02 -04:00
program
.command('keys')
.description('List all SSH keys')
.action(keys.list)
program
.command('key <id>')
.description('List a single SSH key')
.action(keys.info)
2014-11-20 13:02:29 -04:00
2014-11-21 13:56:11 -04:00
program
.command('key:rm <id>')
.description('Remove a SSH key')
.action(keys.remove)
2014-11-17 15:48:26 -04:00
data.prefix.set config.dataPrefix, (error) ->
throw error if error?
2014-11-21 09:23:02 -04:00
program.parse(process.argv)
2014-11-21 12:20:37 -04:00
log.setQuiet(program.quiet)