mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-30 16:13:59 +00:00
Show shorter uuids when listing devices
This commit is contained in:
parent
fb1ef0df63
commit
ebefd816b6
@ -28,8 +28,9 @@ limitations under the License.
|
|||||||
permission: 'user',
|
permission: 'user',
|
||||||
primary: true,
|
primary: true,
|
||||||
action: function(params, options, done) {
|
action: function(params, options, done) {
|
||||||
var Promise, resin, visuals;
|
var Promise, _, resin, visuals;
|
||||||
Promise = require('bluebird');
|
Promise = require('bluebird');
|
||||||
|
_ = require('lodash');
|
||||||
resin = require('resin-sdk');
|
resin = require('resin-sdk');
|
||||||
visuals = require('resin-cli-visuals');
|
visuals = require('resin-cli-visuals');
|
||||||
return Promise["try"](function() {
|
return Promise["try"](function() {
|
||||||
@ -38,6 +39,10 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
return resin.models.device.getAll();
|
return resin.models.device.getAll();
|
||||||
}).tap(function(devices) {
|
}).tap(function(devices) {
|
||||||
|
devices = _.map(devices, function(device) {
|
||||||
|
device.uuid = device.uuid.slice(0, 7);
|
||||||
|
return device;
|
||||||
|
});
|
||||||
return console.log(visuals.table.horizontal(devices, ['id', 'uuid', 'name', 'device_type', 'application_name', 'status']));
|
return console.log(visuals.table.horizontal(devices, ['id', 'uuid', 'name', 'device_type', 'application_name', 'status']));
|
||||||
}).nodeify(done);
|
}).nodeify(done);
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ exports.list =
|
|||||||
primary: true
|
primary: true
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
Promise = require('bluebird')
|
Promise = require('bluebird')
|
||||||
|
_ = require('lodash')
|
||||||
resin = require('resin-sdk')
|
resin = require('resin-sdk')
|
||||||
visuals = require('resin-cli-visuals')
|
visuals = require('resin-cli-visuals')
|
||||||
|
|
||||||
@ -45,6 +46,10 @@ exports.list =
|
|||||||
return resin.models.device.getAll()
|
return resin.models.device.getAll()
|
||||||
|
|
||||||
.tap (devices) ->
|
.tap (devices) ->
|
||||||
|
devices = _.map devices, (device) ->
|
||||||
|
device.uuid = device.uuid.slice(0, 7)
|
||||||
|
return device
|
||||||
|
|
||||||
console.log visuals.table.horizontal devices, [
|
console.log visuals.table.horizontal devices, [
|
||||||
'id'
|
'id'
|
||||||
'uuid'
|
'uuid'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user