"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments)).next());
    });
};
require("./bootstrap");
const shelljs = require("shelljs");
shelljs.config.silent = true;
shelljs.config.fatal = true;
const errors_1 = require("./common/errors");
errors_1.installUncaughtExceptionListener(process.exit);
(() => __awaiter(this, void 0, void 0, function* () {
    let config = $injector.resolve("$config");
    let err = $injector.resolve("$errors");
    err.printCallStack = config.DEBUG;
    let commandDispatcher = $injector.resolve("commandDispatcher");
    let messages = $injector.resolve("$messagesService");
    messages.pathsToMessageJsonFiles = [];
    if (process.argv[2] === "completion") {
        yield commandDispatcher.completeCommand();
    }
    else {
        yield commandDispatcher.dispatchCommand();
    }
    $injector.dispose();
}))();
