"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandLoader = void 0;
const chalk = require("chalk");
const info_command_1 = require("./info.command");
const info_action_1 = require("../actions/info.action");
const sync_command_1 = require("./sync.command");
const sync_action_1 = require("../actions/sync.action");
const ui_1 = require("../lib/ui");
class CommandLoader {
    static load(program) {
        new info_command_1.InfoCommand(new info_action_1.InfoAction()).load(program);
        new sync_command_1.SyncCommand(new sync_action_1.SyncAction()).load(program);
        this.handleInvalidCommand(program);
    }
    static handleInvalidCommand(program) {
        program.on('command:*', () => {
            console.error(`\n${ui_1.ERROR_PREFIX} Invalid command: ${chalk.red('%s')}`, program.args.join(' '));
            console.log(`See ${chalk.red('--help')} for a list of available commands.\n`);
            process.exit(1);
        });
    }
}
exports.CommandLoader = CommandLoader;
