mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 06:57:48 +00:00
4647aa70c0
- Add helpers.confirm() to abstract the process of asking for confirmation. - Add helpers.selectDeviceType() to abstract the form needed to ask for device types. The functions on this module are reused by app actions.
30 lines
586 B
JavaScript
30 lines
586 B
JavaScript
(function() {
|
|
var Promise, form;
|
|
|
|
Promise = require('bluebird');
|
|
|
|
form = require('resin-cli-form');
|
|
|
|
exports.selectDeviceType = function() {
|
|
return form.ask({
|
|
message: 'Device Type',
|
|
type: 'list',
|
|
choices: ['Raspberry Pi', 'Raspberry Pi 2', 'BeagleBone Black']
|
|
});
|
|
};
|
|
|
|
exports.confirm = function(yesOption, message) {
|
|
return Promise["try"](function() {
|
|
if (yesOption) {
|
|
return true;
|
|
}
|
|
return form.ask({
|
|
message: message,
|
|
type: 'confirm',
|
|
"default": false
|
|
});
|
|
});
|
|
};
|
|
|
|
}).call(this);
|