"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/**
 * penguins-eggs
 * command: clean.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 bleach_1 = tslib_1.__importDefault(require("../../classes/bleach"));
class Clean extends core_1.Command {
    async run() {
        const { flags } = await this.parse(Clean);
        utils_1.default.titles(this.id + ' ' + this.argv);
        let verbose = false;
        if (flags.verbose) {
            verbose = true;
        }
        const nointeractive = flags.nointeractive;
        if (utils_1.default.isRoot()) {
            if (nointeractive || await utils_1.default.customConfirm('Select yes to continue...')) {
                const bleach = new bleach_1.default();
                bleach.clean(verbose);
            }
        }
        else {
            utils_1.default.useRoot(this.id);
        }
    }
}
Clean.flags = {
    help: core_1.Flags.help({ char: 'h' }),
    nointeractive: core_1.Flags.boolean({ char: 'n', description: 'no user interaction' }),
    verbose: core_1.Flags.boolean({ char: 'v', description: 'verbose' }),
};
Clean.description = 'clean system log, apt, etc';
Clean.examples = [
    'sudo eggs tools clean',
];
exports.default = Clean;
