"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.configCommand = void 0;
const accounts_1 = require("../accounts");
const logger_1 = __importDefault(require("../logger"));
const telemetry_1 = __importDefault(require("../telemetry"));
function configCommand(program) {
    const configCommand = program.command('config').description('Edit configuration settings');
    const getCommand = configCommand.command('get').description('Get configuration settings.');
    const setCommand = configCommand.command('set').description('Set configuration settings.');
    getCommand
        .command('email')
        .description('Get user email')
        .action(async () => {
        const email = (0, accounts_1.getUserEmail)();
        if (email) {
            logger_1.default.info(email);
        }
        else {
            logger_1.default.info('No email set.');
        }
        telemetry_1.default.record('command_used', {
            name: 'config get',
            configKey: 'email',
        });
        await telemetry_1.default.send();
    });
    setCommand
        .command('email <email>')
        .description('Set user email')
        .action(async (email) => {
        (0, accounts_1.setUserEmail)(email);
        if (email) {
            logger_1.default.info(`Email set to ${email}`);
        }
        else {
            logger_1.default.info('Email unset.');
        }
        telemetry_1.default.record('command_used', {
            name: 'config set',
            configKey: 'email',
        });
        await telemetry_1.default.send();
    });
}
exports.configCommand = configCommand;
//# sourceMappingURL=config.js.map