mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-21 03:55:31 +00:00
Improve apps printing with cliff
This commit is contained in:
parent
8777bb9536
commit
89ec171a3d
@ -1,3 +1,5 @@
|
||||
_ = require('lodash')
|
||||
cliff = require('cliff')
|
||||
server = require('../server/server')
|
||||
applicationModel = require('../models/application')
|
||||
authHooks = require('../hooks/auth')
|
||||
@ -5,5 +7,14 @@ authHooks = require('../hooks/auth')
|
||||
exports.list = authHooks.failIfNotLoggedIn ->
|
||||
|
||||
applicationModel.getAll().then (applications) ->
|
||||
for app in applications
|
||||
console.log "#{app.id} - #{app.app_name}"
|
||||
|
||||
applications = _.map applications, (application) ->
|
||||
return {
|
||||
ID: application.id
|
||||
Name: application.app_name
|
||||
'Device Type': application.device_type
|
||||
'Online Devices': _.where(application.device, is_online: 1).length
|
||||
'All Devices': application.device?.length or 0
|
||||
}
|
||||
|
||||
console.log cliff.stringifyObjectRows(applications, _.keys _.first applications)
|
||||
|
@ -35,6 +35,7 @@
|
||||
"resin-platform-api": "git+ssh://git@bitbucket.org/rulemotion/resin-platform-api.git#master",
|
||||
"bluebird": "~2.3.11",
|
||||
"open": "0.0.5",
|
||||
"inquirer": "~0.8.0"
|
||||
"inquirer": "~0.8.0",
|
||||
"cliff": "~0.1.9"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user