You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.promptForDeviceSelection = promptForDeviceSelection;
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _prompts() {
const data = _interopRequireDefault(require("prompts"));
_prompts = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
async function promptForDeviceSelection(availableDevices) {
const {
device
} = await (0, _prompts().default)({
type: 'select',
name: 'device',
message: 'Select the device you want to use',
choices: availableDevices.filter(d => d.type === 'device' || d.type === 'simulator').map(d => ({
title: `${_chalk().default.bold(d.name)} ${!d.isAvailable && !!d.availabilityError ? _chalk().default.red(`(unavailable - ${d.availabilityError})`) : ''}`,
value: d,
disabled: !d.isAvailable
})),
min: 1
});
return device;
}
//# sourceMappingURL=prompts.js.map