"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/**
 * penguins-eggs
 * command: dad.ts
 * author: Piero Proietti
 * email: piero.proietti@gmail.com
 * license: MIT
 */
const core_1 = require("@oclif/core");
const utils_1 = tslib_1.__importDefault(require("../classes/utils"));
const daddy_1 = tslib_1.__importDefault(require("../classes/daddy"));
const chalk_1 = tslib_1.__importDefault(require("chalk"));
const utils_2 = require("../lib/utils");
class Dad extends core_1.Command {
    async run() {
        utils_1.default.titles(this.id + ' ' + this.argv);
        console.log(chalk_1.default.cyan('Daddy, what else did you leave for me?'));
        const { flags } = await this.parse(Dad);
        if (utils_1.default.isRoot(this.id)) {
            if (flags.clean || flags.default) {
                await (0, utils_2.exec)('rm /etc/penguins-eggs.d -rf');
            }
            const daddy = new daddy_1.default();
            daddy.helpMe(flags.default, flags.verbose);
        }
        else {
            utils_1.default.useRoot(this.id);
        }
    }
}
Dad.flags = {
    clean: core_1.Flags.boolean({ char: 'c', description: 'remove old configuration before to create' }),
    default: core_1.Flags.boolean({ char: 'd', description: 'remove old configuration and force default' }),
    help: core_1.Flags.help({ char: 'h' }),
    verbose: core_1.Flags.boolean({ char: 'v' }),
};
Dad.description = 'ask help from daddy - TUI configuration helper';
Dad.examples = [
    'sudo dad',
    'sudo dad --clean',
    'sudo dad --default',
];
exports.default = Dad;
