"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/**
 * penguins-eggs
 * lib: select_keyboard_option.ts
 * author: Piero Proietti
 * email: piero.proietti@gmail.com
 * license: MIT
 */
const inquirer = require('inquirer');
const keyboards_1 = tslib_1.__importDefault(require("../classes/keyboards"));
/**
  * selectKeyboardOption
  */
async function selectKeyboardOption(selected = '') {
    const keyboards = new keyboards_1.default();
    const options = keyboards.getOptions();
    const supported = [];
    for (const o of options) {
        supported.push(o.code);
    }
    const questions = [
        {
            type: 'list',
            name: 'option',
            message: 'Select option: ',
            choices: supported,
            default: selected,
        },
    ];
    return new Promise(function (resolve) {
        inquirer.prompt(questions).then(function (options) {
            resolve(options.option);
        });
    });
}
exports.default = selectKeyboardOption;
