mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 22:47:48 +00:00
Merge pull request #139 from resin-io/jviotti/feature/drive-widget
Use Visuals drive widget in device init
This commit is contained in:
commit
09fe4b11ad
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var _, async, capitano, commandOptions, deviceConfig, drivelist, form, htmlToText, image, inject, manager, os, path, pine, registerDevice, resin, vcs, visuals;
|
||||
var _, async, capitano, commandOptions, deviceConfig, form, htmlToText, image, inject, manager, os, path, pine, registerDevice, resin, vcs, visuals;
|
||||
|
||||
capitano = require('capitano');
|
||||
|
||||
@ -29,8 +29,6 @@
|
||||
|
||||
form = require('resin-cli-form');
|
||||
|
||||
drivelist = require('drivelist');
|
||||
|
||||
htmlToText = require('html-to-text');
|
||||
|
||||
os = require('os');
|
||||
@ -210,26 +208,7 @@
|
||||
if (params.device != null) {
|
||||
return callback(null, params.device);
|
||||
}
|
||||
return drivelist.list(function(error, drives) {
|
||||
if (error != null) {
|
||||
return callback(error);
|
||||
}
|
||||
return async.reject(drives, drivelist.isSystem, function(removableDrives) {
|
||||
if (_.isEmpty(removableDrives)) {
|
||||
return callback(new Error('No available drives'));
|
||||
}
|
||||
return form.ask({
|
||||
message: 'Drive',
|
||||
type: 'list',
|
||||
choices: _.map(removableDrives, function(item) {
|
||||
return {
|
||||
name: item.device + " (" + item.size + ") - " + item.description,
|
||||
value: item.device
|
||||
};
|
||||
})
|
||||
}).nodeify(callback);
|
||||
});
|
||||
});
|
||||
return visuals.drive().nodeify(callback);
|
||||
}, function(device, callback) {
|
||||
var message;
|
||||
params.device = device;
|
||||
|
@ -12,7 +12,6 @@ registerDevice = require('resin-register-device')
|
||||
pine = require('resin-pine')
|
||||
deviceConfig = require('resin-device-config')
|
||||
form = require('resin-cli-form')
|
||||
drivelist = require('drivelist')
|
||||
htmlToText = require('html-to-text')
|
||||
os = require('os')
|
||||
|
||||
@ -289,23 +288,7 @@ exports.init =
|
||||
return callback(new Error("Invalid application: #{options.application}"))
|
||||
|
||||
return callback(null, params.device) if params.device?
|
||||
drivelist.list (error, drives) ->
|
||||
return callback(error) if error?
|
||||
|
||||
async.reject drives, drivelist.isSystem, (removableDrives) ->
|
||||
|
||||
if _.isEmpty(removableDrives)
|
||||
return callback(new Error('No available drives'))
|
||||
|
||||
form.ask
|
||||
message: 'Drive'
|
||||
type: 'list'
|
||||
choices: _.map removableDrives, (item) ->
|
||||
return {
|
||||
name: "#{item.device} (#{item.size}) - #{item.description}"
|
||||
value: item.device
|
||||
}
|
||||
.nodeify(callback)
|
||||
visuals.drive().nodeify(callback)
|
||||
|
||||
(device, callback) ->
|
||||
params.device = device
|
||||
|
@ -42,7 +42,6 @@
|
||||
"bluebird": "^2.9.34",
|
||||
"capitano": "~1.6.1",
|
||||
"coffee-script": "^1.9.3",
|
||||
"drivelist": "^1.2.2",
|
||||
"html-to-text": "^1.3.1",
|
||||
"lodash": "^3.10.0",
|
||||
"mkdirp": "~0.5.0",
|
||||
@ -50,7 +49,7 @@
|
||||
"npm": "^2.13.0",
|
||||
"open": "0.0.5",
|
||||
"resin-cli-form": "^1.1.0",
|
||||
"resin-cli-visuals": "^1.0.0",
|
||||
"resin-cli-visuals": "^1.1.0",
|
||||
"resin-config-inject": "^2.0.0",
|
||||
"resin-device-config": "^1.0.0",
|
||||
"resin-image": "^1.1.4",
|
||||
|
Loading…
Reference in New Issue
Block a user