mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +00:00
Implement app info action
This commit is contained in:
parent
3015af3aeb
commit
77d84103f6
@ -6,7 +6,6 @@ applicationModel = require('../models/application')
|
||||
authHooks = require('../hooks/auth')
|
||||
|
||||
exports.list = authHooks.failIfNotLoggedIn ->
|
||||
|
||||
applicationModel.getAll().then (applications) ->
|
||||
|
||||
applications = _.map applications, (application) ->
|
||||
@ -19,3 +18,15 @@ exports.list = authHooks.failIfNotLoggedIn ->
|
||||
}
|
||||
|
||||
console.log cliff.stringifyObjectRows(applications, _.keys _.first applications)
|
||||
|
||||
exports.info = authHooks.failIfNotLoggedIn (id) ->
|
||||
applicationModel.get(id).then (application) ->
|
||||
|
||||
console.log("ID: #{application.id}")
|
||||
console.log("Name: #{application.app_name}")
|
||||
console.log("Device Type: #{device.getDisplayName(application.device_type)}")
|
||||
console.log("Git Repository: #{application.git_repository}")
|
||||
console.log("Commit: #{application.commit}")
|
||||
|
||||
.catch (error) ->
|
||||
throw error
|
||||
|
@ -33,6 +33,11 @@ program
|
||||
.description('Show a list of your apps')
|
||||
.action(app.list)
|
||||
|
||||
program
|
||||
.command('app <id>')
|
||||
.description('Show an application')
|
||||
.action(app.info)
|
||||
|
||||
# ---------- Preferences Module ----------
|
||||
|
||||
preferences = require('./actions/preferences')
|
||||
|
@ -1,3 +1,4 @@
|
||||
Promise = require('bluebird')
|
||||
canvas = require('./_canvas')
|
||||
|
||||
exports.getAll = ->
|
||||
@ -6,3 +7,14 @@ exports.getAll = ->
|
||||
options:
|
||||
orderby: 'app_name asc'
|
||||
expand: 'device'
|
||||
|
||||
exports.get = (id) ->
|
||||
return canvas.get
|
||||
resource: 'application'
|
||||
id: id
|
||||
|
||||
.then (application) ->
|
||||
if not application?
|
||||
Promise.reject(new Error('Not found'))
|
||||
|
||||
return application
|
||||
|
Loading…
Reference in New Issue
Block a user