/**
 * penguins-eggs
 * lib: get_password.ts
 * author: Piero Proietti
 * email: piero.proietti@gmail.com
 * license: MIT
 */
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
// import { option } from '@oclif/command/lib/flags'
const inquirer = require('inquirer');
async function getPassword(user = 'root', initial) {
    const requireLetterAndNumber = (value) => {
        if (/\w/.test(value) && /\d/.test(value)) {
            return true;
        }
    };
    return new Promise(function (resolve) {
        const questions = [
            {
                type: 'password',
                message: `Choose a password for ${user}: `,
                name: 'password',
                default: initial,
                // validate: requireLetterAndNumber,
            },
            {
                type: 'password',
                message: `Confirm your ${user} password: `,
                name: 'confirmPassword',
                default: initial,
                // validate: requireLetterAndNumber,
            },
        ];
        inquirer.prompt(questions).then(function (options) {
            resolve(options.password);
        });
    });
}
exports.default = getPassword;
