/**
 * penguins-eggs
 * lib: select_installation_device.ts
 * author: Piero Proietti
 * email: piero.proietti@gmail.com
 * license: MIT
 */
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const inquirer = require('inquirer');
const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
async function selectInstallationDevice() {
    const drives = shelljs_1.default.exec('lsblk |grep disk|cut -f 1 "-d "', { silent: true }).stdout.trim().split('\n');
    const driveList = [];
    drives.forEach((element) => {
        driveList.push('/dev/' + element);
    });
    const questions = [
        // nvme0n1p1, nvme0n1p2, nvme0n1p3
        {
            type: 'list',
            name: 'installationDevice',
            message: 'Select the installation disk: ',
            choices: driveList,
        },
    ];
    return new Promise(function (resolve) {
        inquirer.prompt(questions).then(function (options) {
            resolve(options.installationDevice);
        });
    });
}
exports.default = selectInstallationDevice;
