mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-08 03:44:13 +00:00
Implement simple interface module
This commit is contained in:
parent
8df43575d0
commit
69dbd49444
34
lib/interface/interface.coffee
Normal file
34
lib/interface/interface.coffee
Normal file
@ -0,0 +1,34 @@
|
||||
program = require('commander')
|
||||
packageJSON = require('../../package.json')
|
||||
|
||||
auth = require('../cli-modules/auth/auth')
|
||||
data = require('../data/data')
|
||||
server = require('../server/server')
|
||||
config = require('../config')
|
||||
|
||||
program.version(packageJSON.version)
|
||||
|
||||
program
|
||||
.command('login <username:password>')
|
||||
.description('Login with your resin.io account')
|
||||
.action (credentials) ->
|
||||
parsedCredentials = auth.parseCredentials(credentials)
|
||||
auth.login parsedCredentials, (error) ->
|
||||
throw error if error?
|
||||
|
||||
program
|
||||
.command('apps')
|
||||
.description('Show a list of your apps')
|
||||
.action ->
|
||||
|
||||
# TODO: The details of requesting the API should be handled
|
||||
# by the models. Make use of them once they are implemented
|
||||
server.get '/ewa/application?$orderby=app_name%20asc&$expand=device', (error, response) ->
|
||||
for app in response.body.d
|
||||
console.log "#{app.id} - #{app.app_name}"
|
||||
|
||||
# TODO: Check if not running on UNIX environment
|
||||
# and add a custom path accordingly
|
||||
data.prefix.set config.dataPrefix, (error) ->
|
||||
throw error if error?
|
||||
program.parse(process.argv)
|
Loading…
x
Reference in New Issue
Block a user