2014-11-18 12:35:50 +00:00
|
|
|
data = require('./data/data')
|
2014-11-21 15:40:37 +00:00
|
|
|
log = require('./log/log')
|
2014-11-18 12:35:50 +00:00
|
|
|
config = require('./config')
|
2014-11-21 13:23:02 +00:00
|
|
|
packageJSON = require('../package.json')
|
2014-11-17 19:48:26 +00:00
|
|
|
|
2014-11-21 13:23:02 +00:00
|
|
|
program = require('commander')
|
|
|
|
program.version(packageJSON.version)
|
2014-11-20 16:05:50 +00:00
|
|
|
|
2014-11-21 14:44:48 +00:00
|
|
|
# ---------- Options ----------
|
|
|
|
program.option('-y, --yes', 'Confirm non interactively')
|
2014-11-21 16:20:37 +00:00
|
|
|
program.option('-q, --quiet', 'quiet (no output)')
|
2014-11-24 14:56:03 +00:00
|
|
|
program.option('-t, --type <type>', 'specify a type when creating an application')
|
2014-11-21 14:44:48 +00:00
|
|
|
|
2014-11-18 15:37:29 +00:00
|
|
|
# ---------- Auth Module ----------
|
2014-11-18 15:40:12 +00:00
|
|
|
auth = require('./actions/auth')
|
|
|
|
|
2014-11-21 13:23:02 +00: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 15:37:29 +00:00
|
|
|
|
|
|
|
# ---------- App Module ----------
|
2014-11-18 15:40:12 +00:00
|
|
|
app = require('./actions/app')
|
2014-11-21 13:23:02 +00:00
|
|
|
|
2014-11-24 14:45:54 +00:00
|
|
|
program
|
|
|
|
.command('app:create <name>')
|
|
|
|
.description('Create a resin.io application')
|
|
|
|
.action(app.create)
|
|
|
|
|
2014-11-21 13:23:02 +00: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 13:23:40 +00:00
|
|
|
|
2014-11-21 13:43:03 +00:00
|
|
|
program
|
|
|
|
.command('app:rm <id>')
|
|
|
|
.description('Remove an application')
|
|
|
|
.action(app.remove)
|
|
|
|
|
2014-11-19 17:38:15 +00:00
|
|
|
# ---------- Device Module ----------
|
|
|
|
device = require('./actions/device')
|
2014-11-21 13:23:02 +00:00
|
|
|
|
|
|
|
program
|
|
|
|
.command('devices <id>')
|
|
|
|
.description('Show devices for an application')
|
|
|
|
.action(device.list)
|
2014-11-19 17:38:15 +00:00
|
|
|
|
2014-11-21 17:23:29 +00:00
|
|
|
program
|
|
|
|
.command('device:rm <id>')
|
|
|
|
.description('Remove a device')
|
|
|
|
.action(device.remove)
|
|
|
|
|
2014-11-21 18:21:47 +00:00
|
|
|
program
|
|
|
|
.command('device:identify <uuid>')
|
|
|
|
.description('Identify a device with a UUID')
|
|
|
|
.action(device.identify)
|
|
|
|
|
2014-11-19 12:59:17 +00:00
|
|
|
# ---------- Preferences Module ----------
|
|
|
|
preferences = require('./actions/preferences')
|
2014-11-21 13:23:02 +00:00
|
|
|
|
|
|
|
program
|
|
|
|
.command('preferences')
|
|
|
|
.description('Open preferences form')
|
|
|
|
.action(preferences.preferences)
|
2014-11-19 12:59:17 +00:00
|
|
|
|
2014-11-21 13:30:29 +00:00
|
|
|
# ---------- Info Module ----------
|
2014-11-21 13:23:02 +00:00
|
|
|
program
|
|
|
|
.command('version')
|
|
|
|
.description('Show version')
|
2014-11-21 13:30:29 +00:00
|
|
|
.action ->
|
2014-11-21 15:40:37 +00:00
|
|
|
log.out(packageJSON.version)
|
2014-11-20 16:13:59 +00:00
|
|
|
|
2014-11-20 17:02:29 +00:00
|
|
|
# ---------- Keys Module ----------
|
|
|
|
keys = require('./actions/keys')
|
2014-11-21 13:23:02 +00: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 17:02:29 +00:00
|
|
|
|
2014-11-21 17:56:11 +00:00
|
|
|
program
|
|
|
|
.command('key:rm <id>')
|
|
|
|
.description('Remove a SSH key')
|
|
|
|
.action(keys.remove)
|
|
|
|
|
2014-11-17 19:48:26 +00:00
|
|
|
data.prefix.set config.dataPrefix, (error) ->
|
|
|
|
throw error if error?
|
2014-11-21 13:23:02 +00:00
|
|
|
program.parse(process.argv)
|
2014-11-21 16:20:37 +00:00
|
|
|
log.setQuiet(program.quiet)
|